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 Path: g2news2.google.com!news2.google.com!news.glorb.com!news2.glorb.com!wn11feed!worldnet.att.net!bgtnsc04-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: unsigned type Reply-To: anon@anon.org (anon) References: <878witokbn.fsf@willow.rfc1149.net> X-Newsreader: IBM NewsReader/2 2.0 Message-ID: <6bO6m.112648$d36.73368@bgtnsc04-news.ops.worldnet.att.net> Date: Mon, 13 Jul 2009 22:03:46 GMT NNTP-Posting-Host: 12.65.132.5 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1247522626 12.65.132.5 (Mon, 13 Jul 2009 22:03:46 GMT) NNTP-Posting-Date: Mon, 13 Jul 2009 22:03:46 GMT Organization: AT&T Worldnet Xref: g2news2.google.com comp.lang.ada:7038 Date: 2009-07-13T22:03:46+00:00 List-Id: The RM defines, what a "null range" is, but the RM does not say that you must first check for "null range" then the type and for a valid range in an array or string. The RM allows any vendor to check the type first before checking for a "null range" condition. Or it could be that the RM might assume that subtype checking has already been done, because the RM assume that the compiler and runtime has check that the bound is a scalar type. The GNAT compiler will allow any value for a null range but the GNAT runtime will not. The GNAT runtime system first checks the lower bound type (for Strings the lower bounds must be Positive) then checks for the "null range". This should be corrected by either the compiler should be force to at least check for a valid lower bound or the runtime system. Or better yet just check the type of both bounds first. And if you compile and execute my test suite program you will see just how non-Ada the code becomes when using "null range". In <878witokbn.fsf@willow.rfc1149.net>, Samuel Tardieu writes: >>>>>> "anon" == anon writes: > >anon> But some here and the GNAT compiler says the ( 1 .. 0 ) and ( -5 >anon> .. -7 ) are both valid in the source code. A string with the >anon> range of ( -5 .. -7 ) looks like bad C coding anfd that's not Ada. > >The RM says that explicitely: > >RM 3.5 (4): "A range has a lower bound and an upper bound and specifies >a subset of the values of some scalar type (the type of the range). A >range with lower bound L and upper bound R is described by ``L >... R''. If R is less than L, then the range is a null range, and >specifies an empty set of values. Otherwise, the range specifies the >values of the type from the lower bound to the upper bound, inclusive." > >RM 3.5 (8): "A range is compatible with a scalar subtype if and only if >it is either a null range or each bound of the range belongs to the >range of the subtype. A range_constraint is compatible with a scalar >subtype if and only if its range is compatible with the subtype." > >So 1 .. 0 or -5 .. -7 are null ranges, thus compatible with a Positive >range. > > Sam >-- >Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/