public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Define macro with ...
@ 2009-12-03 13:11 Paulo Flabiano Smorigo
  2009-12-03 20:55 ` Andi Hellmund
  0 siblings, 1 reply; 3+ messages in thread
From: Paulo Flabiano Smorigo @ 2009-12-03 13:11 UTC (permalink / raw)
  To: GCC Help List

Hi everybody,

I have a function for the log like bellow:
void log(DebugLevel_t level, FILE *pArq, const char *fmt, ...);

I want to create a macro with the __func__, __FILE__ and __LINE__ defines.

I created a similar macro for my exception function:
#define EXCEPTION(code) exception(code, __func__, __FILE__, __LINE__);

How do I create this macro if the function has "..."?

Thanks in advance,
Paulo Flabiano Smorigo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Define macro with ...
  2009-12-03 13:11 Define macro with Paulo Flabiano Smorigo
@ 2009-12-03 20:55 ` Andi Hellmund
  2009-12-04  9:39   ` Paulo Flabiano Smorigo
  0 siblings, 1 reply; 3+ messages in thread
From: Andi Hellmund @ 2009-12-03 20:55 UTC (permalink / raw)
  To: Paulo Flabiano Smorigo; +Cc: GCC Help List

Paulo Flabiano Smorigo wrote:
> Hi everybody,
>
> I have a function for the log like bellow:
> void log(DebugLevel_t level, FILE *pArq, const char *fmt, ...);
>
> I want to create a macro with the __func__, __FILE__ and __LINE__ defines.
>
> I created a similar macro for my exception function:
> #define EXCEPTION(code) exception(code, __func__, __FILE__, __LINE__);
>
> How do I create this macro if the function has "..."?
>
> Thanks in advance,
> Paulo Flabiano Smorigo
>
>   
Hey Paulo,

this page greatly explains how to define variadic macros:

http://gcc.gnu.org/onlinedocs/gcc/Variadic-Macros.html

Andi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Define macro with ...
  2009-12-03 20:55 ` Andi Hellmund
@ 2009-12-04  9:39   ` Paulo Flabiano Smorigo
  0 siblings, 0 replies; 3+ messages in thread
From: Paulo Flabiano Smorigo @ 2009-12-04  9:39 UTC (permalink / raw)
  To: Andi Hellmund; +Cc: GCC Help List

Thanks!

That's exactly what i'm looking for...

Paulo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-12-04  2:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-03 13:11 Define macro with Paulo Flabiano Smorigo
2009-12-03 20:55 ` Andi Hellmund
2009-12-04  9:39   ` Paulo Flabiano Smorigo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).