| ??? 11/22/01 10:10 Read: times |
#16809 - RE: Keil |
You should never use // comments in macro definitions for precisely this reason!
Stick with /* */ When the preprocessor expands your macro, it expands it as a single line! - the backslashes are there purely for your convenience in laying out the definition! Thus: #define MAX(A,B)
if( A > B )
return A; // A is biggest
else
return B; // B is biggest Will expand as:if( A > B ) return A; // A is biggest else return B; // B is biggest Which will obviously not compile. It may well be implementation-dependent as to whether the preprocessor strips comments before or after macro expansion, and/or within macro definitions. Thus it is possible that you may get different results on different compilers - or even different versions of the same compiler! |
| Topic | Author | Date |
| Keil's 6.20c problem with comments | 01/01/70 00:00 | |
| RE: Keil\'s 6.20c problem with comments | 01/01/70 00:00 | |
| RE: Keil\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ | 01/01/70 00:00 | |
| RE: Keil\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ | 01/01/70 00:00 | |
| RE: Keil | 01/01/70 00:00 | |
| RE: Keil | 01/01/70 00:00 | |
| RE: Keil | 01/01/70 00:00 | |
| RE: Keil comments - correction | 01/01/70 00:00 | |
| RE: Keil, MSVC, BCB - consensus | 01/01/70 00:00 | |
| RE: Keil\'s 6.20c problem with comments | 01/01/70 00:00 | |
| RE: Keil\'s 6.20c comments - Craig | 01/01/70 00:00 | |
| RE: Keil, MSVC, BCB - consensus | 01/01/70 00:00 | |
| RE: Keil, MSVC, BCB - consensus | 01/01/70 00:00 | |
| RE: Keil\\\'s 6.20c problem with comments | 01/01/70 00:00 | |
| RE: Keil, MSVC, BCB - consensus | 01/01/70 00:00 | |
| RE: Keil, MSVC, BCB - consensus | 01/01/70 00:00 | |
| RE: Keil, MSVC, BCB - Peter | 01/01/70 00:00 | |
First things first! | 01/01/70 00:00 |



