www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/05/11:05:13

From: "Michael N. Filippov" <michael AT idisys DOT iae DOT nsk DOT su>
Newsgroups: comp.os.msdos.djgpp
Subject: How to write #define with several args
Date: 5 Apr 2000 14:33:09 GMT
Lines: 19
Message-ID: <8cfir5$2kui$1@news.itfs.nsk.su>
NNTP-Posting-Host: idisys.iae.nsk.su
X-Trace: news.itfs.nsk.su 954945189 86994 193.124.169.11 (5 Apr 2000 14:33:09 GMT)
X-Complaints-To: usenet AT news DOT itfs DOT nsk DOT su
NNTP-Posting-Date: 5 Apr 2000 14:33:09 GMT
User-Agent: tin/pre-1.4-19990517 ("Psychonaut") (UNIX) (Linux/2.3.99-pre3 (i586))
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello !

Sorry if this question is too silly for this conference :)

Does anybody know how could i write #define to use it with
not predefined number of args. Example:

#include <stdio.h>

#define P(format, s) printf(format, s) // this is for one argument
#define MP(format, ...) printf(format, ...) // error 
...
// and i want to use it as
MP("%s\n", "Hello, world !");
MP("%d:%x:%s\n", i, hex_i, "And so on"); // with not predefined number of args
...

Sincerely,
Michael

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019