Re: g_print vs printf



Peter Jay Salzman <p dirac org> writes:

i'm curious why gtk replaced printf with g_print as a printing function.

does it help portability?   isn't printf standardized by ANSI?

No portability improvements. The main advantage of g_print() is that it
can be redirected using:

  GPrintFunc g_set_print_handler (GPrintFunc func);

Also, for a quick debug printf saves you from having to go up to the top
of your program and #include <stdio.h>

But if you actually want to print to standard out as the output of your
program, I'd advise using printf().

Regards,
                                               Owen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]