c - Add elements to struct by define -
i have problem. i'm trying add struct elements defined constant. sample code (opengl+winapi)
#define engine_struct \ hglrc renderingcontext;\ hdc devicecontext;
and then:
typedef struct swindow { engine_struct hwnd handle; hinstance instance; char* classname; bool fullscreen; bool active; msg message; } window;
is possible?
yes possible, macro simple textual substitution
http://www.cplusplus.com/doc/tutorial/preprocessor/
the preprocessor examines code before actual compilation of code begins , resolves these directives before code generated regular statements.
Comments
Post a Comment