From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b0d68c502c0ae6 X-Google-Attributes: gid103376,public From: dennison@telepath.com Subject: Re: Printing Enum Variable Re: Linux World Date: 1999/03/04 Message-ID: <7bmafu$hnq$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 451175761 References: <7bfc2n$jl9@dfw-ixnews5.ix.netcom.com> <7bhh26$r7c$1@remarQ.com> <36DCAC1F.430E2C5E@aasaa.ofe.org> <7bk4v8$kl8$1@remarQ.com> <36DDA761.7B4E8099@aasaa.ofe.org> X-Http-Proxy: 1.0 x8.dejanews.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Thu Mar 04 15:56:52 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.5 [en] (WinNT; I) Date: 1999-03-04T00:00:00+00:00 List-Id: In article <36DDA761.7B4E8099@aasaa.ofe.org>, David Starner wrote: > fraser@synopsys.ha.com wrote: > > > > I nearly cried when dstarner98@aasaa.ofe.org said: > > > > [ printing enumerations in C example deleted ...] > > > > The point being, of course, that in Ada I write: > > > > Bob'Image (X) > > > > which still works even if I add an apricot. Which solution do you prefer? > > Mine. For my example printed out "Red apple" as opposed to "RED_APPLE", > and could be quickly internationalized. The only way to internationalize > Bob'Image (X) is to rip it out and replace all examples with something > like the code you cut. I don't think direct outputing of enumerations is > right except as a quick and dirty hack - the name mangling require by C > or Ada (no spaces, no hypens, etc.) combined with the i18n problems make > it inappropriate. Actually, I use 'Image and 'Value a *lot*. Perhaps it isn't the best feature in the world for production user interfaces, but it has saved me *months* of time over my career in generating test drivers. It is also quite helpful for configuration files, where users aren't as finiky about the interface. I don't think the argument that it is of no value hold any water at all. In the above applications a C developer would probably end up using integers due to the pain of having to type out 40 or so strings, and calling the i/o routine then strncmp and interpreting the results, etc. My enumeration value interface is much clearer, and thus less error prone. In an application like a config file, that's a big win. And of course if I need your "any string and internationalization" functionality, I can do just what C coders are forced to do for everything. :-) T.E.D. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own