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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -