🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #1449

Re: C macros - variabel aantal parameters

#1449
From: Philip Paeps
Date: Sat, 05 Mar 2005 13:46
28 lines
1598 bytes
Andy Peeters <x.spacerunner@skynet.be> wrote:
> Kort vraagje over C macros.

CPP macro's bedoel je?

> Functies in C kunnen een variabel aantal parameters hebben zoals
> bijvoorbeeld printf. Is dit ook mogelijk met macros?

Ja.

Zelfde syntax als in C, met ... .

 #define my_printf(...) printf(__VA_ARGS__)

Wel beetje voorzichtig mee doen, want al je arguments worden ook macro
expanded.

Zie ook:

  <http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html#Variadic-Macros>

 - Philip

-- 
Philip Paeps                              Please don't email any replies
philip@paeps.cx                               I follow the newsgroup.

  If you can't measure it, I'm not interested.
Technical Details
Message-ID: <4229b846$0$28988$e4fe514c@news.xs4all.nl>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.wiretrip.org!border2.nntp.ams.giganews.com!nntp.giganews.com!transit.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
References: <42298f01$0$14970$ba620e4c@news.skynet.be>

Show Full Headers
Complete Article Headers
X-Google-Thread: fcea4,c77ac4f1c476d0ff
X-Google-Attributes: gidfcea4,public
X-Google-Language: DUTCH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.wiretrip.org!border2.nntp.ams.giganews.com!nntp.giganews.com!transit.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Sender: Philip Paeps <philip@fasolt.home.paeps.cx>
Message-ID: <4229b846$0$28988$e4fe514c@news.xs4all.nl>
From: Philip Paeps <philip+usenet@paeps.cx>
Subject: Re: C macros - variabel aantal parameters
Newsgroups: be.comp.programming
References: <42298f01$0$14970$ba620e4c@news.skynet.be>
Organization: Happily Disorganized
User-Agent: tin/1.7.8-20050217 ("Scalpay") (UNIX) (FreeBSD/6.0-CURRENT (i386))
Date: 05 Mar 2005 13:46:47 GMT
Lines: 28
NNTP-Posting-Host: 195.144.64.15
X-Trace: 1110030407 news.xs4all.nl 28988 [::ffff:195.144.64.15]:51053
X-Complaints-To: abuse@xs4all.nl