[U-Boot] [RESEND PATCH v2 1/5] Tegra2: Add macros to calculate bitfield shifts and masks

Albert ARIBAUD albert.u.boot at aribaud.net
Tue Jul 12 17:29:29 CEST 2011


Hi Anton,

Le 11/07/2011 18:19, Anton Staaf a écrit :

> I know that this is throwing more fuel on the fire (for which I am sorry),
> but I don't follow the argument that this is unportable.  As far as I can
> tell, the # : # syntax is not using any special compiler extensions, it is
> simply substituted into a (boo) ? # : # expression, thus extracting either
> the first of second number from the definition of the bit field.
>
> If I am wrong I would be interested to know what about this is not standard
> pre-processor usage?

For me at least (Wolfgang might have other reasons), the issue is not 
the use of the pre-processor per se, it is that this "syntax" breaks the 
'?:' "triadic" operator in pieces, one piece in argument value and one 
in macro body, and neither piece makes sense from a C standpoint: '5:3' 
represents no meaningful C entity, and 'X ? y' (without the ':' and 
third argument of the operator) is not a proper C construct.

IOW, it is syntactic sugaring done at the expense of code readability.

> Thanks,
>      Anton

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list