#define end_{if|for|while|switch} } Was: Re: #define OR ||

Glenn Caleval Glenn.Caleval at f72.n140.z1.FIDONET.ORG
Fri Feb 16 02:35:00 AEST 1990


 > >       IF () THEN
 > >       ELSE
 > >               ENDIF
 > What if the define's are as follows:
 > #define IF if

Mommy, these men are scaring me!

As someone who is just starting out to learn C, and I mean JUST, 
I have been reading this news for several weeks.  Now I'm 
convinced that either I'm not convoluted enough to work in C or 
else you guys are scaring me on purpose.

Scott McHaffie came close to what I have assumed was the 
sensible approach to this issue with the suggestion: 

 > #define THEN /* start of an if statement */
 > #define ENDIF /* end of an if statement */


But why must it be even convoluted to the point that you have 
extraneous "commands" floating around the source code.  If you 
are concerned about saving keystrokes, why not use the keystroke 
macro editors built into most text editors?

In trying to learn the language I have found it useful to 
extensively comment my infant efforts.  To facilitate this I have 
defined keystroke macros such as ALT-I which produces: /*open if 
statement, level   */ <cursor key to space following the word 
level>, and then manually enter what level the if statement is. 
No unknown statements show up in my code, but using these 
macros, almost every line is commented and for my own safety I 
type in manually the levels to keep track of nesting.

Question:  Doesn't this accomplish the same thing or am I really 
missing something here from my admitted ignorance of the 
language?

--  
Glenn Caleval - via FidoNet node 1:140/22
UUCP: alberta!dvinci!weyr!72!Glenn.Caleval
Internet: Glenn.Caleval at f72.n140.z1.FIDONET.ORG
Standard Disclaimers Apply...



More information about the Comp.lang.c mailing list