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-Thread: 103376,fdd685ffa59d584d,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!r21g2000yqd.googlegroups.com!not-for-mail From: KK6GM Newsgroups: comp.lang.ada Subject: What would be the Ada solution? Date: Fri, 4 Feb 2011 08:33:57 -0800 (PST) Organization: http://groups.google.com Message-ID: <0aa67233-4210-483b-b35c-8e872f87cb8f@r21g2000yqd.googlegroups.com> NNTP-Posting-Host: 12.35.64.226 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1296837237 5825 127.0.0.1 (4 Feb 2011 16:33:57 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 4 Feb 2011 16:33:57 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r21g2000yqd.googlegroups.com; posting-host=12.35.64.226; posting-account=qZVz2QoAAAAN9WxYp-9jYb7jORc4Zqwt User-Agent: G2/1.0 X-HTTP-Via: 1.1 barracudaweb.tritool.rancho:8080 (http_scan/4.0.2.6.19) X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MDDR; .NET4.0C; .NET4.0E; InfoPath.1),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:16868 Date: 2011-02-04T08:33:57-08:00 List-Id: A colleague is working on some old code, written in C, that uses an "out of range" integer value to indicate no valid value. Thus, a default value (in this case 0x7FFFFFFF) means no value has been entered. All code that uses any values should check for this no-value and act accordingly, but of course not all the code actually does that, and there are odd cases where the no-value value gets processed as a valid value and then Bad Things Happen. I'm curious what the Ada approach to this issue would be, the issue being to differentiate between valid and invalid values, and to catch (compile time or run time) any manipulation of an invalid value as if it were a valid value.