Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Jan 2001 14:04:16 -0800
From:      Josef Grosch <jgrosch@mooseriver.com>
To:        Terry Lambert <tlambert@primenet.com>
Cc:        Stephen McKay <mckay@thehub.com.au>, Iain Templeton <iain@research.canon.com.au>, chat@FreeBSD.ORG
Subject:   Re: silly C style question
Message-ID:  <20010125140416.A12493@mooseriver.com>
In-Reply-To: <200101252134.OAA28804@usr08.primenet.com>; from tlambert@primenet.com on Thu, Jan 25, 2001 at 09:32:57PM %2B0000
References:  <200101241124.f0OBOgm22341@dungeon.home> <200101252134.OAA28804@usr08.primenet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 25, 2001 at 09:32:57PM +0000, Terry Lambert wrote:
> > 	if
> > 	(
> > 		(id->id_type == NULL)
> > 		||
> > 		(
> > 			(id->id_type->x_what == xt_arrayof)
> > 			&&
> > 			(item->x_left->x_what == xt_arrayof)
> > 			&&
> > 			(id->id_type->x_subtype == item->x_left->x_subtype)
> > 			&&
> > 			(id->id_type->x_flags & XIS_DIMLESS)
> > 		)
> > 	)
> > 	...
> > 
> > Try that one any other way. :-)
> 
>  	if( ( id->id_type == NULL) ||
>  	    ( ( id->id_type->x_what == xt_arrayof) &&
> 	      ( item->x_left->x_what == xt_arrayof) &&
> 	      ( id->id_type->x_subtype == item->x_left->x_subtype) &&
> 	      ( id->id_type->x_flags & XIS_DIMLESS)))
> 

hmmm, I would have done the following:

  	if ((id->id_type == NULL) ||
  	    ((id->id_type->x_what == xt_arrayof) &&
 	     (item->x_left->x_what == xt_arrayof) &&
 	     (id->id_type->x_subtype == item->x_left->x_subtype) &&
 	     (id->id_type->x_flags & XIS_DIMLESS)))

The lack of a space between the if and the first parenthesis is unclean and
violates style(9) and the space after each opening parenthesis and the lack of
space before each closing parenthesis is also unclean and inconsistent. If one
were being consistent it should be done like this :

  	if ( ( id->id_type == NULL ) ||
  	     ( ( id->id_type->x_what == xt_arrayof ) &&
 	       ( item->x_left->x_what == xt_arrayof ) &&
 	       ( id->id_type->x_subtype == item->x_left->x_subtype ) &&
 	       ( id->id_type->x_flags & XIS_DIMLESS ) ) )



my $0.02


Josef

-- 
Josef Grosch           | Another day closer to a | FreeBSD 4.2
jgrosch@MooseRiver.com |   Micro$oft free world  | www.bafug.org



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010125140416.A12493>