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: fac41,b87849933931bc93 X-Google-Attributes: gidfac41,public X-Google-Thread: 109fba,b87849933931bc93 X-Google-Attributes: gid109fba,public X-Google-Thread: f43e6,b87849933931bc93 X-Google-Attributes: gidf43e6,public X-Google-Thread: 114809,b87849933931bc93 X-Google-Attributes: gid114809,public X-Google-Thread: 1108a1,b87849933931bc93 X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,b87849933931bc93 X-Google-Attributes: gid103376,public From: kst@aonix.com (Keith Thompson) Subject: Re: OO, C++, and something much better! Date: 1997/01/10 Message-ID: #1/1 X-Deja-AN: 208846730 sender: news@thomsoft.com (USENET News Admin @flash) x-nntp-posting-host: pulsar references: <32CCE4ED.6A21@online.no> <5ajo99$khu@panix.com> <32ce7009.280817694@news.zip.com.au> <32D0CA27.44C2@ghgcorp.com> <32D245D5.2C0@ghgcorp.com> organization: Aonix, San Diego, CA, USA newsgroups: comp.lang.c++,comp.lang.smalltalk,comp.lang.eiffel,comp.lang.ada,comp.object,comp.software-eng originator: kst@pulsar Date: 1997-01-10T00:00:00+00:00 List-Id: In dewar@merv.cs.nyu.edu (Robert Dewar) writes: > Actually, when I talked to Alex, he indicated that there were critical > features in Ada 95 that were missing in C and C++ for this kind of > work. In particular, he noted that C lacks a general address comparison > operation, useful for hashing data structures, whereas Ada does have such > an operation (in System.Storage_Elements on type Integer_Address). It is > a bit ironic to identify this particular feature as crucial (since most > people mistakenly think that C has such a feature and Ada doesn't!) Well, sort of. It's true that C pointer comparison is undefined unless the pointers being compared point into the same object (or one past the end of an array). However, any real-world C implementation isn't going to go out of its way to make such comparisons invalid. If pointers "look like" integers at the hardware level, pointer comparison is almost certainly going to be implemented as integer comparison. It may be signed or unsigned, but it's almost certainly going to be consistent within a given implementation. On the other hand, for Ada 95, RM95-13.7.1(16) says that "Operations that do not make sense should raise Program_Error". The AARM (Annotated Ada Reference Manual) gives the examples of X < Y and conversions between Integer_Address and Address on a segmented architecture. (Note also that it's not necessary to use System.Storage_Elements; relational operators on type Address are provided in System.) The use of the word "should" means that an Ada implementation is not *required* to raise Program_Error. Thus it's permissible for address comparisons to behave inconsistently. To summarize, both C and Ada provide relational operations on addresses. Both require such operations to be well-behaved only in certain cases, and leave them more or less undefined in other cases. Both are defined in such a way that any reasonable real-world implementation will almost certainly implement address comparison in the obvious manner, which should be useful for hashing data structures. -- Keith Thompson (The_Other_Keith) kst@aonix.com <*> TeleSo^H^H^H^H^H^H Alsy^H^H^H^H Thomson Softw^H^H^H^H^H^H^H^H^H^H^H^H^H Aonix 10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2706 "SPOON!" -- The Tick