Date: Mon, 19 May 1997 10:47:09 +0200 From: j@uriah.heep.sax.de (J Wunsch) To: hackers@FreeBSD.ORG Cc: core@FreeBSD.ORG Subject: Re: Variable initialization Message-ID: <19970519104709.FO31408@uriah.heep.sax.de> In-Reply-To: <199705190547.HAA04051@labinfo.iet.unipi.it>; from Luigi Rizzo on May 19, 1997 07:47:26 %2B0200 References: <199705190329.NAA29656@godzilla.zeta.org.au> <199705190547.HAA04051@labinfo.iet.unipi.it>
next in thread | previous in thread | raw e-mail | index | archive | help
As Luigi Rizzo wrote: > > Besides, style(9) explicitly says not to obfuscate code by initializing > > variables in declarations. This obfuscation should only be used > > thoughfully. :-). > > Can someone tell me why this is called obfuscation ? No, and it's one of the points where not much of an agreement could be reached even among the core team. Initializing a variable when it's being declared (and not later) is even more crucial if it comes to C++, since it technically makes a big difference there. Just declaring it means the default constructor is called (which must not exist, that will result in an error), while the appropriate constructor will be called if it's initialized immediately. To the very least, this could save quite some useless default initialization (like bzero'ing areas that are about to be filled in a millisecond later). I've cc'ed the core team: we should IMHO make this sentence in style(9) less strict. My English ain't good enough for a better formulation... -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970519104709.FO31408>