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=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c6ca9cbe17b867c4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news1.google.com!newshub.sdsu.edu!ctu-peer!Spring.edu.tw!news.nctu.edu.tw!netnews.eranet.net!news.ttn.net!feeder.seed.net.tw!attdv1!attdv2!ip.att.net!newsfeed1.global.lmco.com!svlnews.lmms.lmco.com!not-for-mail From: "Xenos" Newsgroups: comp.lang.ada Subject: Re: access & address Date: Thu, 14 Oct 2004 15:52:55 -0400 Organization: Hades Message-ID: References: <1c2f5137.0410140105.66fdb23e@posting.google.com> <1347924.5V7QhTSfdI@linux1.krischik.com> <2t7jm8F1sp752U1@uni-berlin.de> <1982479.VT7X1MC7VE@linux1.krischik.com> NNTP-Posting-Host: 158.187.64.144 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Xref: g2news1.google.com comp.lang.ada:5219 Date: 2004-10-14T15:52:55-04:00 List-Id: "Martin Krischik" wrote in message news:1982479.VT7X1MC7VE@linux1.krischik.com... > Most used type is "Ada::Natural" since most C++ programmers can't even get > int and unsigned right and sadly they do write libraries I have to use. That's a very insulting, generalizing, and incorrect statement. Besides, if you think Ada'a Natural is equivalent to C++'s unsigned, that is what is sad. > > There is of corse a weekness: > > typedef Ada::Range Month; > typedef Ada::Range US_Hours; > > And please: I know I could use classes. But that is just another ugly hack! > And why must save and secure be an ugly hack? > One man's ugly hack is another's versatility. Besides, you don't have to use a class to make your above instanitations unique. You can use enums. If you define an enum such as: enum month {First_Month = 0, Last_Month = 12}; The C++ standard says that any value within the range is valid (actually its any value less than or equal to the closed power of 2, not less than 12, but close enough). It also treats month as a unique type for overload resolution. So, your typedef becomes: typedef Ada::Range Month; Which will be unique from Hours. You, of course, will still proclaim it an ugly hack, but you don't need an extra class (and you now have "better" names for your months than 1-12). Besides, ugly or not, the language does give you the ability to overcome its weaknesses. Ugly is a different matter. Regards.