va_list is now an array of some (opaque ?) struct... gee thanks
A little trap in the new 64 bit ABI.
void bar( va_list args) { va_list x; x = args; return( va_arg( x, int)); }
does not work anymore. It gives the error
error: array type 'va_list' (aka 'struct __va_list_tag [1]')
is not assignable
I was curious if there was any "obvious" change in functionality. Here is the part of a function calling bar disassembled for three different architectures. The disassembly shows, that it's the same internally, two pointers are pushed unto the stack (put into parameter registers).
x86_64 movq %rbx, %rsi movl %r12d, %edi call _bar i386: movl -12(%ebp), %eax movl %eax, 4(%esp) movl 8(%ebp), %eax movl %eax, (%esp) call _bar ppc: lwz r4,76(r1) mr r3,r29 bl _bar
What does work in the old and the new world is
void bar( va_list args) { va_list *x; x = &args; return( va_arg( *x, int)); }
where I incur one pointer indirection due to syntax. I am still forming an opinion on that...
Post a comment
All comments are held for moderation; basic HTML formatting accepted.