🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2660

variable argument macros

#2660
From: Rob Cunningham
Date: Sat, 01 Jun 1996 00:00
37 lines
1786 bytes
I have an embedded system application where I need to strip strings in calls
to printfs from my code, and replace it with a common string.  This may sound
ugly, but it is necessary to reduce the size of the code space.

What I want to do is this:

char fixed_text = "error occured\n"
#define printf(a,...) printf(fixed_text)

Or perhaps even:
#define printf(a,...) 

I'd really like to avoid having my code populated with something ugly like

#ifdef STRINGS_REMOVED
	;
#else
	printf("An error message\n");
#endif


Is there a known, portable mechanism for doing this?  (If not, then how about
an ugly kludge that works for the GNU compilers?)

			-Rob
-------------------------------------------------------------------------------
                          Robert K. Cunningham
                           rkc@xn.ll.mit.edu
Machine Intelligence Group		     Cognitive and Neural Systems Dept.
  MIT Lincoln Laboratory                              Boston University
*** My comments, my opinions: my responsibility.
-- 
-------------------------------------------------------------------------------
                          Robert K. Cunningham
                           rkc@xn.ll.mit.edu
Machine Intelligence Group		     Cognitive and Neural Systems Dept.
Technical Details
Message-ID: <4oonaf$81m@solutions.solon.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 100850,225eb80e6a87e5b4,start
X-Google-Attributes: gid100850,public
X-Google-Thread: f65d0,225eb80e6a87e5b4,start
X-Google-Attributes: gidf65d0,public
From: rkc@xn.ll.mit.edu (Rob Cunningham)
Subject: variable argument macros
Date: 1996/06/01
Message-ID: <4oonaf$81m@solutions.solon.com>
X-Deja-AN: 157866274
sender: clc@solutions.solon.com
organization: MIT Lincoln Laboratory
newsgroups: comp.lang.c.moderated,gnu.gcc