0

I have a requirement I need one #ifdef inside another #ifdef. Is it possible to do so:

Like this #ifdef ABC 
            /*code lines*/ 
            #ifdef FGH
               /*code lines*/
            #endif
            /*code lines */
          #endif

Is this structure allowed in c language.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
user3552519
  • 401
  • 4
  • 11
  • 2
    One simple way to check would be to just try. – Ajay Brahmakshatriya May 04 '17 at 04:12
  • @AjayBrahmakshatriya - and, one that would be quicker to try than finding the existing questions on the matter or asking yet another. – enhzflep May 04 '17 at 04:14
  • @ajay, I tried to find, but google didn't give me that option – user3552519 May 04 '17 at 04:23
  • @AjayBrahmakshatriya, how could you answer this question by trying? With how many compilers? Since when is "it works for me" the same as "it is valid according to the standard"? If it works for him, it could still be undefined or implementation defined behaviour. Think about GCC extensions.... – Gerhardh May 04 '17 at 07:34
  • @Gerhardh the -pedantic flag? I just meant something as simple as this need not be asked (and most definitely will be already asked) – Ajay Brahmakshatriya May 04 '17 at 07:37

0 Answers0