Revisiting generalized lvalues
Michael Krasnik
mike@genlogic.com
Sat Oct 29 16:46:00 GMT 2005
Florian Weimer wrote:
> * Michael Krasnik:
>
>
>>#ifdef PRODUCTION
>>#define X_ABC(x) ( check( x ), x->abc )
>>#else
>>#define X_ABC(x) x->abc
>>#endif
>>
>>which expands
>>
>> X_ABC(x) = y;
>>
>>to:
>>
>> ( check( x ), x->abc ) = y;
>
>
>>Eliminating this construct makes macros much less flexible
>>and requires much more work for creating self-verifying
>>frameworks, which is a big issue for small companies with
>>large codebase.
>
>
> There seems to be a trivial fix: modifiy the check function to return
> its argument.
>
The check( x ) is not a function but another set of macros.
Functions are too strongly typed and cause too much code
replication, while we use it generically...
Thanks anyway,
/mike
More information about the Gcc
mailing list