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.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FROM_WORDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f20f5dfbb5c26c12 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-03 13:04:12 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!newspeer1.nwr.nac.net!solnet.ch!solnet.ch!irazu.switch.ch!switch.ch!news.belwue.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail From: "Vincent Smeets" Newsgroups: comp.lang.ada Subject: Re: discriminant in constraint must appear alone Date: Wed, 3 Dec 2003 22:02:52 +0100 Organization: T-Online Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: news.t-online.com 1070485385 07 15231 8QQSGNQ1JiyXSqYf 031203 21:03:05 X-Complaints-To: usenet-abuse@t-online.de X-ID: TlvMSZZJYegLeiZ4SrjnkbSepAJsoICj9o3IJOO8ufnJuRb3UvBN88 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Xref: archiver1.google.com comp.lang.ada:3118 Date: 2003-12-03T22:02:52+01:00 List-Id: Thanks for your answers, After evaluating the possibilities, I wil stick to: B : String (1 .. D); and waist memory and having no constraint check. I am using it in a smal program which I am writing. I can control my self in not violating the constraints. Giving the record two discreminants isn't nice for general use because there needs to be a lot of comments describing the relation between the discreminants. The type needs to be controled type to implement the checking between the discreminants. The checking will be done at run-time, not at compile-time. Defining the type as a controlled type and using dynamic allocation for the arrays is too mush overhead for my problem. The best solution would be a change in the language. Is there something foreseen for the new version of Ada? Thanks, Vincent Smeets "Vincent Smeets" schrieb im Newsbeitrag news:bqiq1m$uis$00$1@news.t-online.com... Hallo, I want to define a discriminated record type with two arrays. One array only half the size of the other. Below is the type definition that I want to use. type R (D : Positive) is record A : String (1 .. D); B : String (1 .. D / 2); end record; This type definition can't be compiled by the GNAT compiler. It gives the error message "discriminant in constraint must appear alone" for the record component B. I know this isn't correct Ada, but how should I define the type in a correct way? I have defined B as B : String (1 .. D); and only used the first half of it, but this way I waist memory and can't have any Ada constraint checks for component B. So this is not the way I want to do it. Are there other possiblities? -- Thanks, Vincent Smeets