From owner-freebsd-chat Fri Jan 26 4:47:58 2001 Delivered-To: freebsd-chat@freebsd.org Received: from proxy.tfcc.com (tfcci.com [204.210.226.249]) by hub.freebsd.org (Postfix) with ESMTP id 6C49B37B401 for ; Fri, 26 Jan 2001 04:47:40 -0800 (PST) Received: (from mail@localhost) by proxy.tfcc.com (8.9.3/8.9.3) id HAA29887; Fri, 26 Jan 2001 07:47:49 -0500 X-Authentication-Warning: proxy.tfcc.com: mail set sender to using -f Received: from icestorm.tfcc.com(192.168.4.115) by proxy.tfcc.com via smap (V2.1/2.1a) id xma029885; Fri, 26 Jan 01 07:47:40 -0500 Date: Fri, 26 Jan 2001 07:47:40 -0500 (EST) From: Chris Fuhrman X-Sender: To: Josef Grosch Cc: Terry Lambert , Stephen McKay , Iain Templeton , Subject: Re: silly C style question In-Reply-To: <20010125140416.A12493@mooseriver.com> Message-ID: Organization: 21st Century Communications MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Thu, 25 Jan 2001, Josef Grosch wrote: > 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 ) ) ) > I'm more of a Perl programmer than a C programmer, but the one thing I like to do, in any language, is to make code as clean and as readible as possible, the main reason being so that I can look at the code and remember the logic. It also helps with anyone who has to maintain the code at a later date. 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 ) ) ) { } /* if ( ( id->id_type == NULL ) || ... ) */ Out of curiousity, does anyone do function declarations like this? int myfunc (int param1, int param2, char * jabber) { } /* myfunc */ I know it's something of a waste of space, but it helps with readability immensely as far as figuring out what params a function takes. Cheers! -- Chris Fuhrman | Twenty First Century Communications cfuhrman@tfcci.com | Software Engineer (W) 614-442-1215 x271 | (F) 614-442-5662 | PGP/GPG Public Key Available on Request To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message