This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to override standard printf defined in gcc library


RahulJain83 wrote:
Above code works fine for following fprintf calls (that pass variable
argument list to fprintf) -

fprintf (stdout,"This is a variable argument message - %s\n", "Rahul Jain");

However, for following fprintf call (that is not taking any variable
arguments), it seems fprintf from libgcc is getting picked up as then print
comes on the screen instead of our Graphical interface window -

fprintf (stdout,"This is a variable argument message - Rahul Jain\n");

I am not sure why this is happening. Is fprintf implemented as macro, such
that it is working for case1 and not for case2. Can anybody help.
Please check that those 'printf()'s haven't been changed to 'puts()'s ! Sometimes I found out that
GCC produces a call to 'puts()' instead of 'printf()' with the simple "Hello World" program... Why
it does this kind of optimization, is unclear but when this happens, doing something similar with 'puts()'
could be your workaround...



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]