Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!purdue!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.std.c Subject: Re: printf zero-pads strings? Message-ID: <20427@mimsy.umd.edu> Date: 27 Oct 89 04:32:19 GMT References: <7279@sdcsvax.UCSD.Edu> <20327@mimsy.umd.edu> <1430@crdos1.crd.ge.COM> <1470@crdos1.crd.ge.COM> Distribution: na Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 26 >In article <20371@mimsy.umd.edu>, chris@mimsy.umd.edu (Chris Torek) writes: > if a precision is specified, the |0| flag will be ignored. > (quoted from the standard) In article <1470@crdos1.crd.ge.COM> davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) writes: > This certainly doesn't grab me as being 'least astonishment.' I >interpret this to mean that if I say %010.2f the |0| is ignored. Yes? No; that clause applies only to [diouxX] formats. Thus, the 0 is not ignored for `%010.2f', but it is ignored for `%010.2d'. Apparently the logic is that the precision here says exactly how many numeric digits are to appear, hence the precision says how many leading zeros there can be, and so the 0 flag should be ignored. >... I certainly find it easier to explain when leading zero means pa > with zeros. Period. I happen to agree, but my copy of the draft does not. Chris -- `They were supposed to be green.' In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris