Source-Changes archive

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

Re: CVS commit: src/usr.sbin/installboot



In article <20061030074656.GJ1205%snowdrop.l8s.co.uk@localhost>,
David Laight  <david%l8s.co.uk@localhost> wrote:
>On Mon, Oct 30, 2006 at 07:03:34AM +0000, Havard Eidnes wrote:
>> 
>> Module Name: src
>> Committed By:        he
>> Date:                Mon Oct 30 07:03:34 UTC 2006
>> 
>> Modified Files:
>>      src/usr.sbin/installboot: ffs.c
>> 
>> Log Message:
>> In order to avoid warnings (which is converted to error with -Werror)
>> about empty bodies in an if-statement, we need to make add some proprocessor
>> conditionals around these if statements.  FFS byte-swapping is sometimes
>> compiled out of install-media versions of this program.
>
>Having to do that is just plain stupid....
>
>I've also deliberatly used:
>
>#define x(y)   if (y); else {...}
>
>To avoid having to wrap the expansion inside do ... while (0);

How is one supposed to use this macro? As 

        a = 3;
        x(y)
        b = 4;
or
        a = 3;
        x(y);
        b = 4;

And then doesn't this completely screw up:

        if (z)
                x(y);
        else
                a = 4;


This is why such macros are not the best thing :-)

christos




Home | Main Index | Thread Index | Old Index