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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c50f57c0c29b391b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 02 Jun 2005 20:40:31 -0500 From: "Steve" Newsgroups: comp.lang.ada References: <1131064.rs72P29t4t@yahoo.com> <1226363.QsRZW1KHie@linux1.krischik.com> Subject: Re: memory management Date: Thu, 2 Jun 2005 18:41:07 -0700 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original Message-ID: NNTP-Posting-Host: 24.22.63.157 X-Trace: sv3-KhXdqggw9ObIf1QZSNmhWpZJwBkKhOFWKEhrchaB8TVfkPB6VbFjOrNSxp29gzBr5VbOFnISoXGQ1y/!OE9w7ye1NrtNeCcwDyIX7QewavFZ/xQ8Q0BaSCiaTfUpF2KMgPvu/J4GNCHo X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:11217 Date: 2005-06-02T18:41:07-07:00 List-Id: "Robert A Duff" wrote in message news:wccoeav8tin.fsf@shell01.TheWorld.com... [snip] > When I say "pointer", I don't mean it has to be implemented as a single > machine address. It could be an offset from some known base address, an > index into an array, or (as you say) a fat pointer -- among other > things. > > The same is true of pointers in C and C++ -- an implementation is free > to implement pointers as something other than a machine address. In > fact, if a C compiler wishes to check array bounds, it pretty much *has* > to use fat pointers. I know of one C compiler that did just that. My > point is that "pointer" is not synonymous with "single machine address", > even in C. While some C/C++ compilers may have checked array bounds, I'm not so sure it complies with a standard. I don't have a copy of the standard available to check. I do know that it is a common C idiom to describe a structure something like: struct Data_Container { int nbValues; int data[1]; } ... numElements = 100; struct Data_Container* dc = malloc( sizeof(Data_Container) + sizeof(int) *( numElements - 1)); dc->nbValues = numElements; for( i = 0 ; i < dc->nbValues ; i++ ) { dc->data[ i ] = 0; } Which would not work if array bounds were checked. I have heard of tools that will do array bounds checking with C, that give some way of describing the above example, but I don't think it is really part of the C/C++ standard. I'm suprised the compiler that did check array bounds was validated... oh wait a minute ;-) Steve (The Duck)