A question of style

Bill Poser poser at csli.Stanford.EDU
Sun Nov 26 06:36:49 AEST 1989


In article <1989Nov23.170838.10376 at phri.nyu.edu> roy at phri.nyu.edu (Roy Smith) writes:
>Would you be confused and/or grossed out if you saw:
>
>	if (something)
>		perror ("message"), exit(1);
>-- 


In addition to having a hidden control structure, I strongly urge you not
to omit braces. I would write:

	if(something){
		somethingelse
	}

This makes the structure much clearer when this is embedded in a lot
of other code, and reduces the likelihood of errors when you add something
to the action taken if the condition is true.



More information about the Comp.lang.c mailing list