home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: sci.math
- Path: sparky!uunet!microsoft!wingnut!stevesa
- From: stevesa@microsoft.com (Steve Salisbury)
- Subject: Re: Calculating pi: help!
- Message-ID: <1992Oct16.200112.22555@microsoft.com>
- Date: 16 Oct 92 20:01:12 GMT
- Organization: Microsoft Corporation
- References: <1992Oct14.112018.19335@kth.se> <7567@charon.cwi.nl> <1992Oct15.103812.7219@kth.se>
- Lines: 25
-
- In article <1992Oct15.103812.7219@kth.se> TordM@VanA.PhySto.SE writes:
- >In article <7567@charon.cwi.nl>, dik@cwi.nl (Dik T. Winter) writes:
- >
- >>Compiler bug? Try main(){printf("%.4d\n",0);} if this program does not
- >>print 0000 your compiling system has a bug.
- >
- > compiler bug indeed; yet another reason not to use "c" :-)
-
- Pardon me, but the compiler does NOT handle printf() format strings --
- that's a C run-time library function. This is in important distinction.
- C run-time libraries are usually closely coupled with a given compiler,
- but that's not the same thing as being "part of" the compiler.
-
- According to the ANSI C standard, %.4d should emit at least four digits
- (using leading zeroes), but this functionality was NOT in the older,
- de facto C standard, the C book by Kernighan & Ritchie.
-
- The more portable and dependable solution would be: printf ("%04d\n",...
-
- Steve Salisbury
-
- * Obligatory *|-------------------------------------------------------|
- * disclaimer *| The views expressed in this message are my own and in |
- * required by *| no way reflect the views of Microsoft Corporation. |
- * my employer: *|-------------------------------------------------------|
-