#define problem
Dave Giunti
Dave.Giunti at p0.f217.n914.z8.RBBS-NET.ORG
Mon Jun 24 13:47:00 AEST 1991
reply to:
>From: beaucham at uxh.cso.uiuc.edu (James Beauchamp)
>Date: 20 Jun 91 05:18:27 GMT
>Organization: University of Illinois at Urbana
>Message-ID: <1991Jun20.051827.23428 at ux1.cso.uiuc.edu>
>Newsgroups: comp.lang.c
JB>
JB>I have many occurences of 'printf(' which I would like to replace with
JB>'fprintf(stderr,' in my C program. Is there a way to do this #define?
JB>
JB>#define printf( fprintf(sterr,
JB>
JB>definitely doesn't parse.
Hi Jim,
I just tried to redefine some curses calls in this manner;
unfortunatly you can't use a single '(' in a #define : it's a
couples only dance. And you can't do a variable parameter pass
inside the finger-nails. Catch 22...
To try and get a little more performence out of Gnu Chess
I was willing to do a little thinking. Here is a solution I
found that worked:
#ifdef MSDOS /* pre #defined by Microsoft C*/
#define printz fprintf /* curses to whatever I needed to test */
#define STDER stderr, /* or any other stream */
#else
#define STDER /* a null declaration */
#endif
then something like
printz( STDER "this could go anywhere"); /* can have meaning */
It might be more usefull to have a couple of classes of defined
output for various chanels.
I should point out that I didn't get faster output from this
and it bloated the code so I junked it... but I am almost positive
I got the comma past the troll of defines.
Dave at Fidonet 1:125/98 (Uhura)
BTW Is anyone else out there hacking on Gnu Chess, either inside
or outside MS DOS?
* EZ 1.33 *
--
Dave Giunti - via RBBS-NET node 8:914/201
INTERNET: Dave.Giunti at p0.f217.n914.z8.RBBS-NET.ORG
More information about the Comp.lang.c
mailing list