X-Spam-Check-By: sourceware.org Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Subject: printf Date: Wed, 1 Aug 2007 13:12:21 -0400 Message-ID: From: "Frederich, Eric P21322" To: X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id l71HCiOg030050 Hello guys, I came across this page comparing different implementations of printf. http://www.and.org/vstr/printf_comparison 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 platforms" If in cygwin, I have a c file like so... #include #include 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. Thanks, ~Eric -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/