FYI, recent gcc vs. glibc's `#define printf(...' vs texinfo-4.0b

Ben Collins bcollins@debian.org
Wed May 2 12:48:00 GMT 2001


On Wed, May 02, 2001 at 07:02:08PM +0200, Jim Meyering wrote:
> 
> ---------------------------------
>   #define printf(fmt, args...) fprintf (stdout, fmt, ## args)
> 
>   static void
>   info_short_help ()
>   {
>     printf ("%s",
>   #ifdef __MSDOS__
>   "a"
>   #else
>   "b"
>   #endif
>             );
>   }
> ---------------------------------
> 

This is a bug in the code. All functions in glibc can also be macros.
You are messing around with what might be a macro. You'll need to fix
your code to look something like this:

#ifdef __MSDOS__
	printf("%s", a);
#else
	printf("%s", b);
#endif

Or "#undef printf" previous to the broken usage of it, so that you get
the function instead of the macro. The example I gave is more readable,
so I suggest it.

Ben

-- 
 -----------=======-=-======-=========-----------=====------------=-=------
/  Ben Collins  --  ...on that fantastic voyage...  --  Debian GNU/Linux   \
`  bcollins@debian.org  --  bcollins@openldap.org  --  bcollins@linux.com  '
 `---=========------=======-------------=-=-----=-===-======-------=--=---'



More information about the Gcc-bugs mailing list