Article View: comp.lang.modula2
Article #2590Re: Report on defect in M2 vs C (Was Modula-2, Modula-3, C or C++)
From: Peter Seebach
Date: Sun, 08 Oct 1995 00:26
Date: Sun, 08 Oct 1995 00:26
33 lines
2028 bytes
2028 bytes
In article <813106607.29468@skipper.demon.co.uk>, Neil Tungate <neil@skipper.demon.co.uk> wrote: >seh@seh.codem.com (Stephen E. Halpin) wrote: >>Something is better than nothing, as long as you dont get a false sense >>of security from it. Im more concerned about boundary behavior, ie what >>happens with (2^31)*4/32.. When executed in order, it should really >>produce an exception - veriants of C which dont optimize to (2^31)/8 >>return 0 and go on their merry way... The simple truth of the matter >>is you have to know something about the underlying machine in almost any >>language. >As a naturally cautious type when programming, I would have written: >(2^31)*(4/32) Why not just write 0 ? It's the same thing. (Hint: 4/32 is 0.) >as a matter of course. This style makes equations easier to read, and >also helps the compiler. ie I am forcing the order of execution at all >times and can therefore ignore compiler nuances :-) No. You're forcing *precedence*. You aren't touching order of *execution*. Nothing keeps the compiler from, say, calculating the 4/32 first, or the 2^31 first. (Though I don't see why you don't just *say* 29 * 0.) -s -- Peter Seebach - seebs@solon.com || seebs@intran.xerox.com -- C/Unix proto-wizard -- C/Unix questions? Send mail for help. No, really! Copyright 1995 Peter Seebach. Like my work? Send donations! The *other* C FAQ - ftp taniemarie.solon.com /pub/c/afq
Technical Details
Message-ID:
<4575rs$ang@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<Pine.SUN.3.91.951005003000.1000A-100000-100000-100000@lagrange.uwaterloo.ca> <4540ha$hqn@regina.seh.codem.com> <813106607.29468@skipper.demon.co.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: seebs@solutions.solon.com (Peter Seebach) Newsgroups: comp.lang.modula2,comp.lang.modula3,comp.lang.c,comp.lang.c++,comp.lang.ada Subject: Re: Report on defect in M2 vs C (Was Modula-2, Modula-3, C or C++) Date: 7 Oct 1995 19:26:36 -0500 Organization: Usenet Fact Police (Undercover) Message-ID: <4575rs$ang@solutions.solon.com> References: <Pine.SUN.3.91.951005003000.1000A-100000-100000-100000@lagrange.uwaterloo.ca> <4540ha$hqn@regina.seh.codem.com> <813106607.29468@skipper.demon.co.uk> NNTP-Posting-Host: 199.199.125.161