Subject: Re: Warnings in nfsv3 code--buggy gcc?
To: J.T. Conklin <jconklin@netcom.com>
From: Michael L. VanLoon -- HeadCandy.com <michaelv@HeadCandy.com>
List: tech-kern
Date: 03/29/1996 18:15:17
>> > -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?

>I don't think so.  When a program "acts" on an unintialized variable,
>most often it's a case that the programmer didn't anticipate (ie. a
>bug).  If a the variable is initialized "just to shut the compiler
>up", there is no telling that the program will behave as intended when
>that dummy value is acted upon either.

Yes, but what about when it's purposely pre-initialized to some value,
rather than assigned a random value "just to shut the compiler up"?

-----------------------------------------------------------------------------
  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...
-----------------------------------------------------------------------------