Jump to content

Talk:Variadic macro in the C preprocessor

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Abdull (talk | contribs) at 09:24, 4 December 2007 (more arguments: new section). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

It should be said how the user (= body of the function) accesses to (possibly existing) extra arguments and their number. MFH: Talk 19:07, 12 May 2005 (UTC)[reply]


now you (Akihabara) added "no means is provided...", although I somehow remember some trick to find it out (but I stopped doing tricky things in C about 10 years ago...) - but maybe the tricks I used then are too tricky to be mentioned officially...(kindof calculations with stack pointers, return adresses sneaked from the stack, memory addresses of passed parameters, etc.etc.) - but wasn't there some simple (and official) VA_NUM_ARGS() macro or so? MFH: Talk 19:14, 13 May 2005 (UTC)[reply]

No. There may be compiler extensions, but there is no way for the macro itself to find out. Note this has nothing to do with stacks; you may be getting confused with variadic functions --Akihabara 22:49, 13 May 2005 (UTC)[reply]


The page says "Previous versions of Visual Studio lack this feature", but I'm compiling some variadic macros in VS 2003. --anon

more arguments

What happens if you use dprintf("Hello, world", "another string", foo, i);? That is: using a variadic macro with a different number of variables. That's what the variadic macros are good for, right? I don't see how this is supposed to work. --Abdull 09:24, 4 December 2007 (UTC)[reply]