qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 6/9] eepro100: Support compilation without EEPRO


From: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH 6/9] eepro100: Support compilation without EEPROM
Date: Tue, 06 Apr 2010 18:01:07 +0200
User-agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090707)

Richard Henderson schrieb:
> On 04/06/2010 04:44 AM, Stefan Weil wrote:
>   
>> +#if EEPROM_SIZE > 0
>>      /* Add 64 * 2 EEPROM. i82557 and i82558 support a 64 word EEPROM,
>>       * i82559 and later support 64 or 256 word EEPROM. */
>>      s->eeprom = eeprom93xx_new(EEPROM_SIZE);
>> +#endif
>>     
>
> If EEPROM_SIZE is known to be defined, even if zero, it is
> better to write this as a C if, not a preprocessor ifdef.
> Let the compiler eliminate the dead code for you.
>
>
> r~
>   

Why do you think that a C if is better than a CPP if
in this case?

Some compilers give warnings for code which will
never be reached. Try gcc -Wunreachable-code.
It's a really useful option which sometimes even
detects programming errors, so maybe it would
be good for qemu, too.

Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]