🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #2831

Re: Printing plural forms.

#2831
From: Tom Christiansen
Date: Mon, 25 Feb 1991 22:29
20 lines
1467 bytes
From the keyboard of browns@iccgcc.decnet.ab.com (Stan Brown):
: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");
       printf("%d file%s copied\n", nfiles, nfiles==1?" was":"s were");

Hardly close to correct; operator precedence dictates an implict
parethesization of:

       printf("%d file%s copied\n", nfiles, nfiles=(1?" was":"s were"));

The "or" branch of the conditional will therefore never be taken.  
You surely want `==' where you have `=' right now.

--tom
-- 
"UNIX was not designed to stop you from doing stupid things, because
 that would also stop you from doing clever things." -- Doug Gwyn

 Tom Christiansen                tchrist@convex.com      convex!tchrist
Technical Details
Message-ID: <1991Feb25.222944.8065@convex.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!olivea!uunet!convex!tchrist
References: <1991Feb19.104810.549@ZYX.SE> <3331.27c23984@iccgcc.decnet.ab.com> <3404.27c905aa@iccgcc.decnet.ab.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!olivea!uunet!convex!tchrist
From: tchrist@convex.COM (Tom Christiansen)
Newsgroups: comp.lang.misc
Subject: Re: Printing plural forms.
Message-ID: <1991Feb25.222944.8065@convex.com>
Date: 25 Feb 91 22:29:44 GMT
References: <1991Feb19.104810.549@ZYX.SE> <3331.27c23984@iccgcc.decnet.ab.com> <3404.27c905aa@iccgcc.decnet.ab.com>
Sender: tchrist@convex.com (Tom Christiansen)
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: CONVEX Software Development, Richardson, TX
Lines: 20