Re: [Dev-C++] #define a "function" with variable number of parameters
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2005-12-18 09:43:46
|
Sometimes it's possible to use a #define that doesn't take any parameters:
#include <cstdarg>
#include <cstdio>
#define LOG log
void log(const char *msg,...) {
va_list ap;
va_start(ap,msg);
vprintf(msg,ap);
va_end(ap);
}
int main() {
LOG("test %u %u\n",1,2);
return 0;
}
/Per W
On Sun, 18 Dec 2005, Daniel K. O. wrote:
> Minds Work wrote:
>
> > Is there a way to change the #define LOG_INFO to receive a variable
> > number of parameters to use the new LOG->info method?
>
>
> See:
> http://david.tribble.com/text/cdiffs.htm#C99-pp-vararg
>
>
> ---
> Daniel K. O.
>
>
>
>
>
>
> _______________________________________________________
> Yahoo! doce lar. Fa=E7a do Yahoo! sua homepage.
> http://br.yahoo.com/homepageset.html
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi=
les
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|