On Tue, 17 Jul 2012 15:02:44 +0100, Jacob Carlborg <d...@me.com> wrote:

On 2012-07-17 14:32, Regan Heath wrote:


After a bit of googling and a test with my local MSVC9 I think old-style
variadics look like this:

#include <varargs.h>
#include <stdio.h>

void foo(va_alist)
     va_dcl
{
     va_list p;
     va_start(p);
     vprintf("%d %d %d\n", p);
}

void main()
{
     foo(1, 2, 3);
}

(the above runs and outputs "1 2 3" on the console)

The same syntax is/was supported by GNU C, see:
http://ftp.gnu.org/old-gnu/Manuals/glibc-2.2.3/html_chapter/libc_34.html#SEC676



I believe, if you see an "old-style" function declaration in a header
file like:

     int foo ();

that you can't actually assume anything about it's parameters, it may
have /any/ number of parameters, and may or may not be variadic.

Clang seems to interpret it as a variadic function. Then if that is correct or not I don't know.

All my googling for "old style" "variadic" etc returned the use of va_alist and va_dcl so I can't see where/why Clang would do what it's doing.

R

--
Using Opera's revolutionary email client: http://www.opera.com/mail/

Reply via email to