Re: mdadm 0.8 suggestions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 04, 2002 at 02:54:08PM +1000, Neil Brown wrote:
> > In the FAQ you might add:
> > 
> > ==========================================
> > Q. Why won't the code compile with compiler optimization turned on (-O2)
> >    under gcc 2.96 (redhat special), gcc 2.95.3, or gcc 3.04?
> > 
> > A. Remove '-Werror' from CFLAGS in the Makefile.  The usage of minsize
> >    and maxsize in Create.c leads the compiler to stop due to a 
> >    perceived error.
> > 
> > A. Alternately, re-write the code to make the compilers happy, and
> >    post it to the linux-raid list.
> > 
> > ==========================================
> 
> I'd rather just fix it.  Is it that gcc thinks they might not be
> initialized, as they are only set inside conditionals?  If  you just
> initialize both to 0, does that fix it?

Your code is perfectly correct as is.  It's just compiler paranoia.

The short answer is initializing the values to 0 will make
the compiler happy, even through there is no need for you
to do so to be programatically correct.

Compilers these days throw up a flag for what look to be like
uninitialized values in conditionals.  The compiler spots the
compile-time uninitialized value in a conditional and complains, but
your code guarantees the value will be defined when it is used.

-- 
Brian Litzinger <brian@worldcontrol.com>
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux