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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC 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!news.glorb.com!news2.telebyte.nl!news-fra1.dfn.de!newsfeed.hanau.net!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: access & address Date: Fri, 15 Oct 2004 10:53:39 +0200 Organization: AdaCL Message-ID: <1137756.92Qd5cOqoD@linux1.krischik.com> References: <1c2f5137.0410140105.66fdb23e@posting.google.com> <1347924.5V7QhTSfdI@linux1.krischik.com> <2t7jm8F1sp752U1@uni-berlin.de> <1982479.VT7X1MC7VE@linux1.krischik.com> Reply-To: krischik@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1097831112 04 24072 3dkRXsVLQ2ddI7g 041015 09:05:12 X-Complaints-To: usenet-abuse@t-online.de X-ID: Z2TyUBZereaOrzWnI0AZ30c5vd1apqX-cFXpJY9oGEjyGkOrH2zCEz User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:5244 Date: 2004-10-15T10:53:39+02:00 List-Id: Xenos wrote: > > "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. Born out of experience. Prehaps I have just seen to much code where the result of sizeof or std::string::lenght was stored in an int or long or whatever else is just available. The returnvalue for both is size_t. I am not suprising that Win64 takes so long to finish. And then there was the infamous netscape installer which refused the installation because I had "-2147483648" bytes free. Well, the drive had in fact 6GB free and the 32 bit free function returend maximum availability - 4GB. > Besides, > if > you think Ada'a Natural is equivalent to C++'s unsigned, that is what is > sad. No. Natural is an int with only positive values. Which means that it can be savely converted into either int or unsigned int. >> 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. Well, I see the difference between a hack and versatility it terms of syntax clutter (I am not against typing if it make things clear) and sematic clutter (Does the average developer understand what i am doing) > 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). Well actually, for the type Month it is quite cool. > Besides, ugly or not, the language does give you the > ability to overcome its weaknesses. Ugly is a different matter. But there are two killer question: Does the stl have it? Does the average library vendor use it? I am not sitting on an island programming for fun. With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com