Bill Caroselli <qtps@earthlink.net> wrote:
OK. This one is silly.
In a C program I am writing a __USAGE message.
I want to use the word it’s.
With a single single-quote mark the compiler complains about an
unterminated string. With two single-quote marks, I get no compiler
errors, but the usage message displays with two single-quote marks.
I also tried escaping the quote with a backslash.The compiler didn’t
like that either.
What is the proper way to display a single-quote mark in a usage message?
Also, since I have not defined __USAGE anywhere, why is the compiler
even seeing what’s inside of that #ifdef block?
Shouldn’t the preprocessor be removing those lines?
I would have thought it should, but you’ve already complained about GCC
Here’s a clever hack I saw:
/*
#ifdef __USAGE
it’s
double quote (")
#endif
*/
The other thing, which is what I do now, is to keep the usage in “main.use”.
Ugly, IMHO, because keeping it in main.c keeps me honest w.r.t. the command
line processing
Cheers,
-RK
–
Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.