From owner-freebsd-hackers Thu Oct 17 06:14:37 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id GAA29098 for hackers-outgoing; Thu, 17 Oct 1996 06:14:37 -0700 (PDT) Received: from mercury.ukc.ac.uk (mercury.ukc.ac.uk [129.12.21.10]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id GAA29092 for ; Thu, 17 Oct 1996 06:14:34 -0700 (PDT) Received: from kestrel.ukc.ac.uk by mercury.ukc.ac.uk with SMTP (PP); Thu, 17 Oct 1996 14:13:41 +0100 Received: from localhost by kestrel.ukc.ac.uk (5.x/UKC-2.14) id AA11442; Thu, 17 Oct 1996 14:13:39 +0100 Date: Thu, 17 Oct 1996 14:13:38 +0100 (BST) From: "K.J.Koster" To: hackers@freebsd.org Subject: Re: enum considered bad ? In-Reply-To: <9609178455.AA845559205@cc4.dttus.com> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > the _size_ of the type, I use #define'd constants and more explicit types. > Hmm. I personally prefer const instead of #define, where possible, because it gives your constant a type. However, my opinion is colored by c++. Another c-thing that I don't see very often is: { /* ... */ const size_t len = sizeof (buffer); /* ... */ } instead of { size_t len; /* ... */ len = sizeof (buffer); /* ... */ } This might be useful to track down accidental modifications of len. Further, it attempts to limit (but fails, it's C ;) the scope of len to where it's actually used. And it asserts that len is actually initialised when it's used. It cannot be used uninitialised. Disadvantage is that you don't always know where to look for the definition of len, it is no longer in the top part of the function. But I personally find this not a problem, since I try to give varables meaningful names. (And that is not the "iLen" convention, I _hate_ that) Groetjes, Kees Jan ===========================================================V=== Kees Jan Koster kjk1@ukc.ac.uk < no address yet :( > =============================================================== Who is this General Failure, and why is he reading my disk? ===========================================================^===