Re: Are C pitfalls the mistake of standard or that of implementations?
From: Christian Bau (christian.bau_at_cbau.freeserve.co.uk)
Date: 02/10/05
- Next message: Eric Sosman: "Re: Are C pitfalls the mistake of standard or that of implementations?"
- Previous message: Walter Roberson: "Re: Interesting Quest - Any optimized way to find if consective one's exist in a word!"
- In reply to: Chris Croughton: "Re: Are C pitfalls the mistake of standard or that of implementations?"
- Next in thread: Eric Sosman: "Re: Are C pitfalls the mistake of standard or that of implementations?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 09 Feb 2005 23:21:30 +0000
In article <slrnd0l2g5.nuo.chris@ccserver.keris.net>,
Chris Croughton <chris@keristor.net> wrote:
> On Wed, 9 Feb 2005 18:36:57 -0000, Bart C
> <bc@freeuk.com> wrote:
>
> >
> > "Chris Croughton" <chris@keristor.net> wrote in message
> > news:slrnd0k4l0.uqv.chris@ccserver.keris.net...
> >
> >>>> jacob navia wrote:
> >
> >>>>>D:\lcc\mc63\test>lc tpr.c
> >>>>>Warning tpr.c: 5 printf: too many arguments
> >>>>>0 errors, 1 warnings
> >
> >> Correct, there are no errors in that statement. The error is in your
> >> compiler, and the code snippet is one way to fix it (altering the
> >> variables to suit).
> >>
> >> Hint: is one plural?
> >
> > Took me a while to get your point. However I think that is a little unfair.
> > I'm using an MS OS which (with their thousands of staff and tens of billions
> > of pounds) is still sprinkled with "1 Files", "1 Folders" and so on.
>
> I rest my case, it's a prime example of crapness <g>.
>
> > Maybe
> > the idea of having just ONE file might be alien to them.
>
> They've done it since early PCDOS times, when often there was only one
> file on the floppy...
>
> > My own efforts are better behaved but sometimes dealing with multi-languages
> > means plurals are not that straightforward. But no excuse for MS though.
>
> Yes, i18n is more of a problem. The solution is similar, though, you
> just need to put the whole words in the conditionals:
>
> printf("%d %s\n", number,
> number == 1 ? gettext("file") : gettext("files"));
>
> (or something like that).
This depends very much on the language you are using. English is
relatively simple. Different languages treat the number zero
differently; in some languages it would be "0 file", in others it would
be "0 files". Some languages have different words for 0, 1, and many. In
some languages it depends on the last digit: It would be "101 file", but
"102 files". And there are probably rules when to use words instead of
digits ("one file", not "1 file").
Now to make things a bit more complicate, try to write code that prints
"1st file", "2nd file" and so on correctly for arbitrary numbers. Then
try to investigate the rules for different languages. Have fun.
- Next message: Eric Sosman: "Re: Are C pitfalls the mistake of standard or that of implementations?"
- Previous message: Walter Roberson: "Re: Interesting Quest - Any optimized way to find if consective one's exist in a word!"
- In reply to: Chris Croughton: "Re: Are C pitfalls the mistake of standard or that of implementations?"
- Next in thread: Eric Sosman: "Re: Are C pitfalls the mistake of standard or that of implementations?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|