arndt@zyx.ZYX.SE (Arndt Jonasson) (02/19/91)
We all have seen and, in various degrees, been irritated by texts such as: 1 files were copied when it should have been: 1 file was copied I'd like to know: when programming, how do you avoid such errors? Are there features in the programming language you use (or other languages you know) that make plural handling especially easy or difficult? Are there features in your native language that make plural handling especially difficult? All opinions and information are welcome (though I'm more interested in how people actually produce a correct text, rather than their excuses for not doing so). Reply to me by email, and I'll post a summary. [I cross-post this to comp.lang.c, because I think I will reach a larger audience that way.] -- Arndt Jonasson, ZYX AB, Styrmansgatan 6, 114 54 Stockholm, Sweden email address: arndt@zyx.SE or <backbone>!mcsun!sunic!zyx!arndt
browns@iccgcc.decnet.ab.com (Stan Brown) (02/20/91)
In article <1991Feb19.104810.549@ZYX.SE>, arndt@zyx.ZYX.SE (Arndt Jonasson) writes: > We all have seen and, in various degrees, been irritated by texts such > as: > 1 files were copied > when it should have been: > 1 file was copied > > I'd like to know: when programming, how do you avoid such errors? printf("%d error%s copied\n", nfiles, nfiles?"s were":" was"); or printf("files copied: %d\n", nfiles); Hey--this is all my opinion, nobody else's. Rely on it at your peril. email: browns@iccgcc.decnet.ab.com Stan Brown, Oak Road Systems, Cleveland, Ohio, USA +1 216 371 0043
browns@iccgcc.decnet.ab.com (Stan Brown) (02/26/91)
> In article <1991Feb19.104810.549@ZYX.SE>, arndt@zyx.ZYX.SE (Arndt Jonasson) writes: >> We all have seen and, in various degrees, been irritated by texts such >> as: >> 1 files were copied >> when it should have been: >> 1 file was copied >> >> I'd like to know: when programming, how do you avoid such errors? In article <3331.27c23984@iccgcc.decnet.ab.com>, I stuck my coding pencil in my ear: > printf("%d error%s copied\n", nfiles, nfiles?"s were":" was"); > or > printf("files copied: %d\n", nfiles); Several persons emailed to point out one or more of the the obvious errors in the first one. I would correct it to printf("%d file%s copied\n", nfiles, nfiles=1?" was":"s were"); This assumes that "0 files were copied" is correct. For that reason, and because it's less susceptible to bonehead errors like mine, I prefer the second form, which gives "files copied: 0", "files copied: 1", "files copied: 2". Hey--this is all my opinion, nobody else's. Rely on it at your peril. email: browns@iccgcc.decnet.ab.com Stan Brown, Oak Road Systems, Cleveland, Ohio, USA +1 216 371 0043
vongease@hplred.HP.COM (Terry Von Gease) (02/27/91)
>>> We all have seen and, in various degrees, been irritated by texts such >>> as: >>> 1 files were copied >>> when it should have been: >>> 1 file was copied >>> >>> I'd like to know: when programming, how do you avoid such errors? > >In article <3331.27c23984@iccgcc.decnet.ab.com>, >I stuck my coding pencil in my ear: >> printf("%d error%s copied\n", nfiles, nfiles?"s were":" was"); >> or >> printf("files copied: %d\n", nfiles); > >Several persons emailed to point out one or more of the the obvious errors >in the first one. I would correct it to > printf("%d file%s copied\n", nfiles, nfiles=1?" was":"s were"); >This assumes that "0 files were copied" is correct. For that reason, and >because it's less susceptible to bonehead errors like mine, I prefer the >second form, which gives "files copied: 0", "files copied: 1", "files >copied: 2". > and further compounding of a bonehead error... > printf("%d file%s copied\n", nfiles, nfiles=1?" was":"s were"); ^^^^^^ how about ... nfiles==1?... instead? Terry