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


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.



Relevant Pages

  • Re: infinity
    ... Virgil said: ... >> Only for computer languages for which there is always some limit on ... >> limit on either S or L, so no inherent limit on N. That TO limits ... so that the 10^-1 digit of x becomes the 10^0 digit of Tr, ...
    (sci.math)
  • Re: Calculating Any Decimal Place in Pi?
    ... it to computation of the 10^10th digit of pi; the second is described in the parent page as ... The Science Channel had a program about him called "Super Intellectuals". ... Daniel T, as he was referred to, speaks 7 languages and learned Icelandic in a week for the program! ...
    (sci.math)
  • Re: Solid Edge or Solid Works on 3D
    ... I don't want to be unfair to SE and I appreciate the help. ... Knowing two languages does open the eyes. ...
    (comp.cad.solidworks)
  • Re: VB.NET or C#
    ... "Gerry Hickman" wrote in message ... It's a bit unfair to hold a languages name against it isn't it? ... It's not the language that defines your ability, ...
    (microsoft.public.dotnet.general)