This is the mail archive of the cygwin mailing list for the Cygwin 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]


Hello guys,

I came across this page comparing different implementations of printf.

The author says...
"Note that if you want a portable version of printf() in your code, you
are _much_ better off using something that natively parses the format
string. This ensures that you get the same parsing behavior on all

If in cygwin, I have a c file like so...

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[]){
    printf("Which printf am I using?\n");

... and I compile it under cygwin with "gcc -mno-cygwin test.c"...
Would I be using one that "natively parses the format string"?
... now if I compile without the -mno-cygwin option, what happens?

I was looking around in some gcc source code for printf and found
vprintf.c which calls vfprintf.c with stdout, which calls _doprnt.
All of these were in a directory called "libiberty".  Furthermore, the
_doprnt winds up calling fprintf.

Does GCC have it's own implementation of printf and is it different than
glibc's implementation?

As you can tell, I don't understand much about this.  Why would both gcc
and glibc have a printf implementation?  Any help is appreciated.

I am also looking into this because I wanted to create my own
specialized version of printf which prints to two files with just one
function call.  I would be doing some different things on each file.  I
was looking for a good vfprintf to start with.


Unsubscribe info:
Problem reports:

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