This is the mail archive of the
mailing list for the binutils project.
Re: macro's and local variables
On 10/19/2012 01:21 AM, Jan Beulich wrote:
> I don't follow - an assembler is an assembler, not a C compiler.
Yet even an assembler can use the C syntax and semantics for *expressions*.
It's useful, widely understood, easy to document, easy to implement,
easy to test and maintain. The omitted operators truly are missed
by writers of assembly code.
For instance: http://lists.libav.org/pipermail/libav-devel/2012-August/032685.html
(and its ancestors):
>> -#define TMPSIZE \size * (8 - 8*(\size > 4) + \ytaps - 1)
>> +/* True relational expressions have the value -1 in the GNU assembler,
>> + +1 in Apple's. */
>> +#ifdef __APPLE__
>> +# define TMPSIZE \size * (8 + 8*(\size > 4) + \ytaps - 1)
>> +# define TMPSIZE \size * (8 - 8*(\size > 4) + \ytaps - 1)
> If the assembler evaluates conditional expressions
> then this can be unified, removing the configuration-dependent "#if":
> #define TMPSIZE \size * (8 + ((\size > 4) ? 8 : 0) + \ytaps - 1)
!!(\size > 4) would work if GNU as had the unary ! operator.
(1 && (\size > 4)) would work if Apple's assembler had the && operator.
((\size > 4) * (\size > 4)) might work, but I'm not at all convinced it
is any better.
In the worst case, let text which appears between '\007' (control-G)
characters be interpreted as a C expression.