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,b61052ba3fdc8c26 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-06 06:48:09 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!howland.erols.net!news-out.worldnet.att.net.MISMATCH!wn3feed!worldnet.att.net!135.173.83.72!wnfilter2!worldnet-localpost!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail Message-ID: <3BE7F836.B9B78AB5@worldnet.att.net> From: James Rogers X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Integers and Mathematical Correctness References: <1f26o22.1xfvwvo111pfi4N%csampson@inetworld.net> <9rrsou$bl1$1@nh.pace.co.uk> <3BE4232D.6CC9ACA3@adaworks.com> <9s68pu$9j5$1@nh.pace.co.uk> <3BE766F6.3D014CD8@worldnet.att.net> <9s7ulq02pdq@drn.newsguy.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 06 Nov 2001 14:48:09 GMT NNTP-Posting-Host: 12.86.34.139 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1005058089 12.86.34.139 (Tue, 06 Nov 2001 14:48:09 GMT) NNTP-Posting-Date: Tue, 06 Nov 2001 14:48:09 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:15913 Date: 2001-11-06T14:48:09+00:00 List-Id: "peter@nospam" wrote: > > In article <3BE766F6.3D014CD8@worldnet.att.net>, James says... > > > > >Note that this error would have been caught by an Ada compiler. > >C never notices the problem at all. > > > > Many languages do not notice these things and more, but people still use > them, much more than Ada, and they spend long hours in the 'debugger' trying > to find why the problem does not work (then feel so good about finding the > bug). There is a whole industry out there build around debugging C > flavoured languages. > > I wonder if the latest C flavoured language 'C#/windows only language', > from Microsoft fixes some of these problems? I think this was the point Marin was making. C has header files that define minimum and maximum values for numeric types, but the use of those header files is optional. Furthermore, those minimum and maximum values are not part of the type definition. Instead, they are simply constants defined in several header files. The C constants provide you the opportunity to develop code to check for overflow or underflow conditions. There is no default check for those conditions. My cursory look at C# indicates that it also has the implicit conversions found in C, C++, and Java. Note that Java, for instance, "solves" the implicit conversion problem by making all integer forms use unsigned semantics even though all the integer types are signed entities. This ensures that the result of all implicit conversions will be a value within the range of the type on the left hand side of an assignment. Of course, there is no assurance that the result will be even remotely correct in a mathematical sense. As you say, many people use these languages and spend long hours debugging their code. My experience is that people use these languages for two primary reasons: they have been told to and they do not know any better. Neither of these reasons provide any technical justification. Jim Rogers Colorado Springs, Colorado USA