Welcome to the Builder Academy

Question ifdef macro question

More
05 Jul 2015 19:28 - 05 Jul 2015 19:41 #5405 by krell
ifdef macro question was created by krell
Can one set up a valid ifdef with a similar arrangement to the below pseudocode in C?
Code:
#if (conditional statement) #define macro_a_m1 #define macro_a_m2 #define macro_a_m3 . . #define macro_a_m-1 #define macro_a_m #else #define macro_b_n1 #define macro_b_n2 #define macro_b_n3 . . #define macro_b_n-1 #define macro_b_n #endif
Last edit: 05 Jul 2015 19:41 by krell. Reason: fixed pseudocode code so intent is clearer to the reader

Please Log in or Create an account to join the conversation.

More
05 Jul 2015 19:35 - 05 Jul 2015 19:36 #5406 by Kyle
Replied by Kyle on topic ifdef macro question
I think the pre-processor will accept that, but unless you mean for your example not to be read literally, you're repeatedly defining the token 'macro' to mean a different thing. I can't remember if it will just be overwritten or if it will cause a conflict.
Last edit: 05 Jul 2015 19:36 by Kyle.

Please Log in or Create an account to join the conversation.

More
05 Jul 2015 19:39 #5407 by krell
Replied by krell on topic ifdef macro question
No, definitely wasn't meant to be read literally though in hindsight I can see why it might be. I'll fix it so it's clear I meant something like macro_a_n1 etc.... :-)

Thanks.

Please Log in or Create an account to join the conversation.

More
06 Jul 2015 00:08 #5411 by Kyle
Replied by Kyle on topic ifdef macro question
Then yup, that will definitely work!

Please Log in or Create an account to join the conversation.

Time to create page: 0.210 seconds