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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4deb6c62a5e19f2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-30 18:21:50 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!fr.usenet-edu.net!usenet-edu.net!fr.clara.net!heighliner.fr.clara.net!news.tpi.pl!not-for-mail From: taw@pb220.legnica.sdi.tpnet.pl (Tomasz Wegrzanowski) Newsgroups: comp.lang.ada Subject: Re: type Foo_ptr in new void*; Date: 31 Jul 2001 01:21:50 GMT Organization: tp.internet - http://www.tpi.pl Message-ID: <9k517e$rbh$5@news.tpi.pl> References: <9k03jc$2me$2@news.tpi.pl> <9k0j60$n4t$1@news.tpi.pl> <3B63F48A.2E2642C6@earthlink.net> <9k2btj$5hj$1@news.tpi.pl> <3B64C26F.C195B4E0@worldnet.att.net> Reply-To: taw@users.sourceforge.net NNTP-Posting-Host: pb220.legnica.sdi.tpnet.pl X-Trace: news.tpi.pl 996542510 28017 213.25.230.220 (31 Jul 2001 01:21:50 GMT) X-Complaints-To: usenet@tpi.pl NNTP-Posting-Date: 31 Jul 2001 01:21:50 GMT User-Agent: slrn/0.9.7.1 (Linux) Xref: archiver1.google.com comp.lang.ada:10802 Date: 2001-07-31T01:21:50+00:00 List-Id: In article <3B64C26F.C195B4E0@worldnet.att.net>, James Rogers wrote: > Yes, you are correct. C does allow you to forward declare a structure > or a pointer without ever completing the definition. This is one of > the nasty capabilities "provided" by C. You can even create an array > of Foo *. However, pointer arithmetic from the start of this array > produces unspecified behavior. What is the sizeof Foo? Since it is > undefined, there is no correct answer to that question. Without a > proper definition of the sizeof Foo, there can be no reliable pointer > arithmetic. Correct answer is compilation error. It's illegal to do pointer arith on void* or incomplete types. > In other words, you can declare some wonderful data structures in C > based on incomplete type definitions. Unfortunately, a program built > upon such a structure is neither reliable nor portable. It's both portable and reliable. > Ada does not allow you to compile a program with an incomplete type > definition. There is no equivalent because the existence of an > equivalent to this C capability would only introduce errors in your > program. There is nothing positive that can be achieved by allowing > a program to be incompletely specified. Sure, if your favourite language has no feature X, then feature X is useless. Incomplete types warrant opacity.