Subject: Re: Warnings in nfsv3 code--buggy gcc?
To: Gordon W. Ross <gwr@mc.com>
From: Michael L. VanLoon -- HeadCandy.com <michaelv@HeadCandy.com>
List: tech-kern
Date: 03/29/1996 18:13:24
>> From: jconklin@netcom.com (J.T. Conklin)
>> Date: Fri, 29 Mar 1996 07:05:40 -0800 (PST)
>> -Wuninitialized is a good warning, but since it's not 100%, I don't
>> recommend combining it with -Werror.  Some people get around this by
>> always initializing the variable to some dummy value.  I think this
>> is terrible practice, as it defeats the ability of run-time tools 
>> that track variable usage to detect uninitialized variable usage.

>Well, isn't the point to avoid uninitialized variables?
>If you initialize it, haven't you solved the problem?

Actually, there's a school of coding practice that says to initialize
all variables before-hand to avoid compiler-specific bugs (it works on
one compiler, because it zero-initializes a variable used before
assigned, then breaks on a different build that doesn't
zero-initialize; or it works on a certain build where a predictable
pattern in memory makes things work, then changes in a different build
because memory is laid out differently), as well as avoiding a bug
where some new code is inserted into an existing routine, using an
existing variable before the existing initializer code is reached.
I'm sure there are many differing opinions on what is "right",
however...

-----------------------------------------------------------------------------
  Michael L. VanLoon                                 michaelv@HeadCandy.com
       --<  Free your mind and your machine -- NetBSD free un*x  >--
     NetBSD working ports: 386+PC, Mac 68k, Amiga, HP300, Sun3, Sun4,
                           DEC PMAX (MIPS), DEC Alpha, PC532
     NetBSD ports in progress: VAX, Atari 68k, others...
-----------------------------------------------------------------------------