Mail Archives: djgpp/1998/04/30/06:19:09
>This is off-topic, but I'm curious about something. I know that the
>European custom is to write decimal numbers using a comma for the
>decimal point and a period for the thousands separator, whereas the
>American (and British, AFAIK) custom is the reverse. However, every
>program I've ever seen that deals with decimal numbers does not
>recognize commas. My pocket calculator certainly doesn't have a comma
>key.
>
>So, is there a special language variant of C/C++ for Europeans where the
>role of ',' and '.' are reversed, and special European calculators and
>numeric keypads? Or do you just have to remember to type numbers in the
>American style when you program? It could be extremely confusing either
>way.
The italian keyboard has a dot printed on the key in its numeric pad,
but it outputs a comma (!!!) both in dos and windows. I guess this is
because
of different codepages or national language support provided by the os.
(btw, I think that non-US keyboards are terrible for programmers:
my IT keyboard at office hasn't got tilde, curly and square brackets, sharp
and hat, a real nightmare for programming, with all those ALT-xxx
sequences!
And that's why at home I have a US keyboard :-)
The C language is always the same, so we write float literals using the
dot as decimal separator. It is not so confusing, it is more or less like
remember to use single or double quotes for strings in different
programming
languages :-)
And maybe we are lucky because C has not a "date" datatype!
The problem is not on the programmer side: the problems come up when you
have
to interact with users who don't even know that somewhere in the world they
use dots in stead of commas or put the month before the day in a date!
You have to write your own versions of input/output functions to cope with
numbers
with commas, money amounts with dots, dates in dd/mm/yy format; and that's
the
hard part! :-)
I hope your curiosity is satisfied now! :-)
ciao
Giacomo
- Raw text -