Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/19/02 19:34
Read: times


 
#24637 - RE: SDCC Compiler
I wrote:
"...never have an unterminated cpmment [sic!] (including a C++ style // comment) on the end of a #define... :-0"

Donald Catto suggested:
"I think you mean 'never have an unterminated /* */ comment anywhere'"

That, of course, is true!

But what I was really trying to say was, don't have a comment on a #define line which is not terminated on that same line; eg,
#define FRED blah     /* This comment is OK */

#define STUFF fleeble /* This comment is dodgy,
                         because the termination is on a different line!
                         Therefore the #define contains 
                         an unterminated comment!
                       */

"// comments at the end of #defines are fine if the preprocessor handles them intelligently. Keil certainly does"

This is true. However, I have seen preprocessors which do not handle it intelligently: they include the unterminated comment as part of the definition. Then, of course, the macro expansion gives you an unterminated comment in the middle of your code - and you get all sorts of weird errors!!

In fact, I think this behaviour is not only unintelligent, but actually incorrect - I believe that K&R specify that comments should be removed before macros are defined (I don't have my copy to hand at the moment).

List of 29 messages in thread
TopicAuthorDate
SDCC Compiler            01/01/70 00:00      
RE: SDCC Compiler            01/01/70 00:00      
RE: SDCC Compiler            01/01/70 00:00      
RE: SDCC Compiler            01/01/70 00:00      
RE: SDCC Compiler - mahmood            01/01/70 00:00      
RE: SDCC Compiler - mahmood, chris            01/01/70 00:00      
You're right :-)            01/01/70 00:00      
RE: SDCC Compiler - chris            01/01/70 00:00      
Mahmood!!!            01/01/70 00:00      
RE: SDCC Compiler            01/01/70 00:00      
RE: srry got your msg after i replied            01/01/70 00:00      
To: Mehmood            01/01/70 00:00      
Ijaz!!!!!            01/01/70 00:00      
RE: srry got your msg after i replied            01/01/70 00:00      
RE: To: Mehmood            01/01/70 00:00      
RE: To Alex            01/01/70 00:00      
RE: SDCC Compiler            01/01/70 00:00      
RE: SDCC Compiler            01/01/70 00:00      
RE: SDCC Compiler            01/01/70 00:00      
RE: SDCC Compiler            01/01/70 00:00      
RE: SDCC Compiler            01/01/70 00:00      
RE: SDCC Compiler            01/01/70 00:00      
RE: SDCC Compiler            01/01/70 00:00      
RE: SDCC Compiler, Michael Schmitt            01/01/70 00:00      
RE: SDCC Compiler, @Michael and @Peter            01/01/70 00:00      
RE: SDCC Compiler            01/01/70 00:00      
RE: SDCC Compiler            01/01/70 00:00      
RE: SDCC Compiler, @ Michael Schmitt            01/01/70 00:00      
RE: SDCC Compiler            01/01/70 00:00      

Back to Subject List