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.7 required=5.0 tests=BAYES_00,INVALID_DATE, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4c86cf2332cbe682 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-18 10:02:54 PST Path: nntp.gmd.de!Germany.EU.net!EU.net!howland.reston.ans.net!gatech!udel!news.mathworks.com!uunet!newsgate.watson.ibm.com!watnews.watson.ibm.com!ncohen From: ncohen@watson.ibm.com (Norman H. Cohen) Newsgroups: comp.lang.ada Subject: Re: Ada.strings.bounded problems? Date: 18 Jan 1995 18:02:54 GMT Organization: IBM T.J. Watson Research Center Distribution: world Message-ID: <3fjl4e$h9b@watnews1.watson.ibm.com> References: <3f49ps$kgl@gnat.cs.nyu.edu> <3fja22$fab@source.asset.com> Reply-To: ncohen@watson.ibm.com NNTP-Posting-Host: rios8.watson.ibm.com Date: 1995-01-18T18:02:54+00:00 List-Id: In article <3fja22$fab@source.asset.com>, weisek@source.asset.com (Kevin Weise) writes: |> I know! I know! The traditional response to this is that a good |> optimizing compiler will remove the discriminant. But in practice, I |> haven't seen this happen. ... |> Perhaps, if this is truly possible, GNAT may make |> some inroads in this area of optimization. It isn't always a win. If you pass a discriminated object to a procedure with an unconstrained parameter (which is possible even if the discriminant has no default initial value), and if the actual does not have a discriminant stored with it, you have to either pass the discriminant as a hidden extra parameter or make a copy of the actual that does have the discriminant. If you have an access type designating a type with nondefaulted discriminants, you must store discriminants of the designated objects either with the objects themselves or with the pointers. Which one saves more space or time depends on the relative numbers of objects pointed to and objects pointing at them. -- Norman H. Cohen ncohen@watson.ibm.com