AnsweredAssumed Answered

#error directive format

Question asked by Doug Olson on Apr 9, 2007
Latest reply on Apr 10, 2007 by CompilerGuru
I am using the CWHCS12 toolset and am trying to compile some C-code that contains variaous #error directives.  The #error directives contain some phases enclosed by single quote characters.  When compiling this code I get errror C4422 from the compiler.
 
By trial and error I have narrowed it down to the formats of #error directive text strings that work and don't work.
 
// Strings accepted by the compiler include...

#if 0
#error "This 'test' works."
#endif

#if 0
#error This test works.
#endif


// Strings that don't work include...

#if 0
#error This 'test' doesn't work, it gives error C4422.
#endif
 
Does anyone know what the ANSI-C standard says the format of the text strings supported by the #error directive should be?
 
Is the behavior I described above consistent with this standard?
 
Thanks,
--Doug

Outcomes