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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7f2513845b4ef39f X-Google-Attributes: gid103376,public From: dvdeug@x8b4e53cd.dhcp.okstate.edu (David Starner) Subject: Re: More C Date: 2000/01/28 Message-ID: <86rbgm$9ic1@news.cis.okstate.edu>#1/1 X-Deja-AN: 578644720 References: <3B9k4.122$Ro5.7388@nnrp3-w.snfc21.pbi.net> Organization: Oklahoma State University User-Agent: slrn/0.9.6.2 (Linux) Reply-To: dstarner98@aasaa.ofe.org Newsgroups: comp.lang.ada Date: 2000-01-28T00:00:00+00:00 List-Id: On Fri, 28 Jan 2000 05:14:39 GMT, tmoran@bix.com wrote: >type SDL_Palette is record > Number_Of_Colors: C.Int; > Colors: Color_List_Access; >end record; > >I presume you really want Colors to point to a Color_List, not to a >single color. Note that Colors will point to a list of N colors, >where N may, or may not, equal Number_Of_Colors. So you can either >ignore Number_Of_Colors (using Palette.Colors.all'length if you need >the count of colors in the list) or you can have your "Indexed" >function do a check that "Index in 1 .. Number_Of_Colors" or >"Index in 0 .. Number_Of_Colors-1" or whatever, in addition to the >automatic index check. This seems wrong. What gives Ada the information about how long that list is? Looking at the C structure, the reason why Number_Of_Colors was stored there is so that the length is known, and it is not stored anywhere else. -- David Starner - dstarner98@aasaa.ofe.org If you wish to strive for peace of soul then believe; if you wish to be a devotee of truth, then inquire. -- Friedrich Nietzsche