🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #49742

[Q] macro calls macro which calls function why?

#49742
From: Kai Harrekilde-Petersen
Date: Thu, 09 Dec 1993 14:20
17 lines
1162 bytes
I'm looking on how to implement a `va_assert()' macro, ie: an assert() with
variable arguments.

I used assert.h from my Linux system as a template. I found that assert is
defined like this:

#define assert(expr) __assert(<something>)
#define __assert(<something> ( ... blah blah blah ... )

Why is such a 'double macro' expansion used? Couldn't I just go the direct
way, like:

#define assert(expr) (expr==0? 0 : (printf(something); abort())


Kai Harrekilde-P.
Technical Details
Message-ID: <KAIHP.93Dec9152004@idsun3.id.dth.dk>
Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!netmbx.de!zib-berlin.de!xlink.net!howland.reston.ans.net!pipex!sunic!uts!id.dth.dk!ideal!kaihp

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,154d4f55c797a29d,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-12-14 05:37:10 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!netmbx.de!zib-berlin.de!xlink.net!howland.reston.ans.net!pipex!sunic!uts!id.dth.dk!ideal!kaihp
From: kaihp@id.dth.dk (Kai Harrekilde-Petersen)
Subject: [Q] macro calls macro which calls function why?
Message-ID: <KAIHP.93Dec9152004@idsun3.id.dth.dk>
Sender: news@id.dth.dk (USENET News System)
Organization: Department of Computing Science, The Technical University of
 Denmark
Distribution: gnu
Date: Thu, 9 Dec 1993 14:20:04 GMT
Lines: 17