Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-winken!uunet!kddlab!titcca!sragwa!wsgw!socslgw!diamond!diamond From: diamond@diamond.csl.sony.junet (Norman Diamond) Newsgroups: comp.lang.c Subject: Re: Dates & things in C Message-ID: <10326@socslgw.csl.sony.JUNET> Date: 5 Jun 89 03:53:59 GMT References: <1128@draken.nada.kth.se> <1604@optilink.UUCP> Sender: news@csl.sony.JUNET Reply-To: diamond@csl.sony.junet (Norman Diamond) Organization: Sony Computer Science Laboratory Inc., Tokyo, Japan Lines: 44 In article <1604@optilink.UUCP> cramer@optilink.UUCP (Clayton Cramer) writes: >It's a shame that more Americans aren't sensitive to the inter- >national differences. For example, the user interface software >I'm writing will be compiled for several different countries, and >it's really only a little more work to say: > > #ifdef AMERICA > sprintf(Buffer, "%s-%02d-%02d", MonthStr, Date, Year); > #else /* BENIGHTEDPARTSOFWORLD */ > sprintf(Buffer, "%02d-%s-%02d", Date, MonthStr, Year); > #endif > >See? Just be sensitive. :-) There are a lot of #else-#if's. For example, in Japan, sprintf(Buffer, "%02d.%02d.%02d", Year, Month, Date); but really more like sprintf(Buffer, "%c02d$BG/(J%02d$B7n(J%02d$BF|(J", Era, Year, Month, Date); ... my apologies to those of you who can't see the characters for "year", "month", and "day" in the above character string 'cause you're using fascist terminals which aren't sensitive to international character sets... We really need a preprocessor #switch for this. In practice, execution-time if's are more common, and they should be but aren't execution-time switch's. Anyway, if you want to sell your software to other locales, you will code your software with proper sensitivities. If you want to buy software that someone didn't want to sell you, well, you're got a little bit of work to do. And if you don't want to buy software that someone didn't want to sell you, then why worry about it? -- Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.co.jp@relay.cs.net) The above opinions are my own. | Why are programmers criticized for If they're also your opinions, | re-implementing the wheel, when car you're infringing my copyright. | manufacturers are praised for it?