Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbatt!ucbvax!maynard.UUCP!campbell From: campbell@maynard.UUCP.UUCP Newsgroups: mod.computers.vax Subject: Re: printf() bug in VMS C 2.0? Message-ID: <8612101211.AA06974@ucbvax.Berkeley.EDU> Date: Sun, 7-Dec-86 02:40:43 EST Article-I.D.: ucbvax.8612101211.AA06974 Posted: Sun Dec 7 02:40:43 1986 Date-Received: Sun, 14-Dec-86 00:48:04 EST References: <8612041854.AA23322@ucbvax.Berkeley.EDU> Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: campbell%maynard.UUCP@talcott.HARVARD.EDU (Larry Campbell) Organization: The Boston Software Works, Inc. Lines: 26 Approved: info-vax@sri-kl.arpa Summary: nope In article <8612041854.AA23322@ucbvax.Berkeley.EDU> levy@ucbvax.Berkeley.EDU@ttrdc.UUCP writes: >I have found what appears to be a bug in printf under VMS C 2.0 (running on >VMS 4.3). >... > printf("X%2.2dX\n",2); > >will produce the output line >X 2X > ... >Under all versions of UNIX C compilers that I have tried, I get what I want: >X02X > >Is this a "known bug"? Yes, it is a "known bug" in your program. You want: printf("X%02dX\n",2); I tried your example under VENIX (UNIX V7) and got "X 2X", as I should. See K&R, page 146. In fact, if the UNIX C compilers you tried really produced "X02X", they disagree with K&R, and should be fixed. -- Larry Campbell The Boston Software Works, Inc. Internet: campbell@maynard.bsw.com 120 Fulton Street, Boston MA 02109 uucp: {alliant,wjh12}!maynard!campbell +1 617 367 6846 ARPA: campbell%maynard.uucp@harvisr.harvard.edu MCI: LCAMPBELL