Constants in conditionals

Robert Osborne robert at isgtec.UUCP
Thu Feb 28 11:03:55 AEST 1991


In article <1991Feb21.121452.29969 at watmath.waterloo.edu>,
datangua at watmath.waterloo.edu (David Tanguay) writes:
#In article <858 at isgtec.UUCP> robert at isgtec.UUCP (Robert Osborne) writes:
#|datangua at watmath.waterloo.edu (David Tanguay) writes:
#|> "if( PATCH_MODE ) { ... }", where PATCH_MODE is a cpp macro (0 or 1).
#|> I know I coud use #if (or #ifdef), but I find them too ugly.
#|Nice attitude towards programming;
#|"I don't use any language constructs *I* don't find aesthetically pleasing"
#
#Same one you're advocating: if( constant ) is a valid language construct
#that you don't want anybody to use (i.e., you want the compile to warn
#people off of it).
No, not the same at all.  I want a warning because, like most people, when
I have a constant in a conditional it is usually a mistake.  If it isn't
then I ignore the warning.  Note that
	i = 0;
	start_loop:
		if( i >= 10 ) goto end_loop;
		...
		i++;
	goto start_loop;
	end_loop:
is a "valid language construct" but most people use
	for(i=0; i<10;i++) {
		...
	}

Rob.
----
Robert A. Osborne   ...uunet!utai!lsuc!isgtec!robert or robert at isgtec.uucp



More information about the Comp.lang.c mailing list