Re: Macro var args

From: bartek (spam.will.eat.itself_at_o2.pl)
Date: 05/15/04


Date: Sat, 15 May 2004 15:27:16 +0000 (UTC)

TheDD <pas.d.email@pas.de.spam.fr> wrote in
news:c85980$uor$1@news-reader2.wanadoo.fr:

> Hello all,
>
> right now, i'm using the following macro to automatically add
> informations to exceptions:
>
> #define THROW(Class, args...) throw Class(__FILE__, __LINE__, ## args)
>
> but AFAIK, it's gcc specific. Is there a way to do it in a standard
> c++ way?

Not really.

Though, there's a very interesting alternative technique.

See the following article by Andrei Alexandrescu and John Torjo.
http://www.cuj.com/documents/s=8464/cujcexp0308alexandr/cujcexp0308alexandr.html

-- 
:: bartekd [at] o2 [dot] pl


Relevant Pages

  • Macro var args
    ... i'm using the following macro to automatically add informations ... to exceptions: ... but AFAIK, it's gcc specific. ...
    (comp.lang.cpp)
  • Re: Macros with a variable number of arguments
    ... > has variable argument macros with a different syntax (which modern GCC ... > needed when the variable part of the macro is empty. ... > printf() except it sends all output to log_file instead of stdout. ...
    (comp.lang.c)
  • Re: [PATCH] i386 add Intel PEBS and BTS cpufeature bits and detection
    ... That would add considerable latency to all exceptions. ... .macro errorentry sym ... +extern int netburst; ...
    (Linux-Kernel)
  • Re: Macros with a variable number of arguments
    ... The specific syntax being used is GCC specific. ... the variable part of the macro is empty. ... ANSI C and new GCC syntax ...
    (comp.lang.c)
  • Re: Dangerous code in cpumask_of_cpu?
    ... Rusty Russell writes: ... macro to allocated array), and I don't think it's safe: ... I'm surprised this hasn't already hit us, but perhaps gcc isn't as ... puts the address in eax and derefences it immediately, ...
    (Linux-Kernel)