Variable Argument Macro

In computer programming, a variable argument macro, or varargs macro, is a feature of the C programming language which permits preprocessor macros to accept a varying number of arguments. Their syntax is similar to that of variable argument functions: The special sequence "..." is used to indicate one or more arguments. The identifier __VA_ARGS__ in the macro definition is then substituted by these arguments. For example, if a printf-like function dprintf() were desired, which would pass the file and line number from which it was called as arguments, the following macro might be used:
  void realdprintf (char const *file, int line, char const *fmt, ...);   #define dprintf(...) realdprintf(__FILE__, __LINE__, __VA_ARGS__); 
dprintf() could then be called as:
  dprintf("Hello, world");  /* Expands to:    *     realdprintf(__FILE__, __LINE__, "Hello, world");    */ 
or:
  dprintf("%d + %d = %d", 2, 2, 5);  /* Expands to:    *     realdprintf(__FILE__, __LINE__, "%d + %d = %d", 2, 2, 5);   */ 
Variable argument macros are supported in the C language since ISO/IEC 9899:1999, C99.

 

<< PreviousWord BrowserNext >>
solar system model
lincoln park (park)
trent fm
jonathan bowers
d. g. anderson
lillian martin
whirlpool galaxy
stargate (video game)
ira coleman batman
alex escobar
juan daz de sols
smolensky district
lincoln's inn fields
edgardo alfonzo
sokolsky district
tuberoinfundibular pathway
visby (disambiguation)
sosnovsky district
euclid and his modern rivals
sovetsky district
st. andrew's cathedral
samuel ben judah ibn tibbon
marine drive
henry blanco
cathedral church of saint andrew
spassky district
sunzhensky district
tambovsky district
alan gordon cunningham
roger cedeo
tersky district
troitsky district
ibn tibbon
tselinny district
simn bolvar international airport
irish examiner
georgia on my mind
petrine theory
ulyyanovsky district
aubrey holes
grant show
usolsky district
donald faison
volodarsky district