Standard indentation?

Peter da Silva peter at ficc.uu.net
Mon Dec 12 12:02:36 AEST 1988


In article <846 at starfish.Convergent.COM>, jerry at starfish.Convergent.COM (Gerald Hawkins) writes:
> Here is a confusing one:

> Is it ever ok to use the form:
> 	if (a = b * 2 + 39)		/* intentional assignment within condition
> 	*/

Yes, but probably only in the common idiom:

	if((var = func(...)) == STATUS)
	{

Such as:

	if((fp = fopen(...)) == NULL)
	{
		perror(...);
		return FAILURE;
	}

or:

	if((nextc = getchar()) != EOF)
	{
		...
	}
-- 
Peter da Silva     `-_-'     Ferranti International Controls Corporation
   "Have you hugged  U  your wolf today?"        uunet.uu.net!ficc!peter
Disclaimer: I accept full responsibility for my typos. peter at ficc.uu.net



More information about the Comp.lang.c mailing list