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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ea0955083361ce29 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-22 20:30:46 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!lnsnews.lns.cornell.edu!newsstand.cit.cornell.edu!ngpeer.news.aol.com!newsfeed1.cidera.com!Cidera!newsfeed.cwix.com!wn14feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi.com!sccrnsc01.POSTED!not-for-mail From: "SteveD" Newsgroups: comp.lang.ada References: <3e05aebf.3122500@news.freenet.de> <3e0608b6.2790531@news.freenet.de> Subject: Re: unconstrained records X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: NNTP-Posting-Host: 12.211.13.75 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc01 1040617845 12.211.13.75 (Mon, 23 Dec 2002 04:30:45 GMT) NNTP-Posting-Date: Mon, 23 Dec 2002 04:30:45 GMT Organization: AT&T Broadband Date: Mon, 23 Dec 2002 04:30:46 GMT Xref: archiver1.google.com comp.lang.ada:32216 Date: 2002-12-23T04:30:46+00:00 List-Id: "Jan" wrote in message news:3e0608b6.2790531@news.freenet.de... [snip] > > So when I write the following code (this one works), the string in > "name" will ALWAYS occupy 15 bytes? > > > subtype Max_Index is Natural range 0 .. 15; > > type Test (length : natural := 0) is > record > text : string (1..length); > end record; > > name : Test; > Yes. "name" will always occupy 15 bytes. Note however that if you declare: name2 : Test( 3 ); Then the string in name will always occupy 3 bytes. Also: While I don't consider the LRM a good place to learn Ada, it is a good place to find out what is available in the standard packages. I suggest perusing Annex A. It gives a nice index to the standard packages. The packages Ada.Strings.Fixed, Ada.Strings.Bounded, and Ada.Strings.Unbounded are useful for dealing with strings. Steve (The Duck) > > > Thanks! > > P.S. It's no homework, just a hobby.