PLEX86  x86- Virtual Machine (VM) Program
 CVS  |  Mailing List  |  Download  |  Newsgroups

Thou shalt have no other gods before the ANSI C standard 1559


Your Ad Here

Your Ad Here

On Sun, 27 Feb 2005 02:05:23 GMT, Brian Inglis

Not according to the C standard, although it may work on some implementations -- probably less than it used to. As already noted.

No. There is wording the Fortran standard that arguably can be read to mean that a compiler can suppress identical function calls within one statement: the canonical example is IDICE = MYRAND(6) + MYRAND(6). This is frequently discussed, or at least recapitulated, on comp.lang.fortran, and AFAICR no one has ever identified a compiler which actually does this, only the theoretical possibility one might.

Thou shalt have no other gods before the ANSI C standard 1563
many situation where they are playing catchup is because security hasn't been built into the infrastructure ... and has become a re-active post...

Beyond a statement boundary, never. Unless, as with all optimizations, it (definitely) produces the same result as the unoptimized way, which in general means the compiler knows the function body. Now, for intrinsic functions, the compiler does know; and for the closest Fortran analogue, LENTRIM(str), the compiler knows it depends only on the value of str, can detect all possible writes to str since Fortran prohibits writing of (most) aliased arguments, and can move or eliminate the calls appropriately -- not to mention inlining them.

Thou shalt have no other gods before the ANSI C standard 1560
Charlie Gibbs As a matter of style, there is no clearly "right" way to position the braces. The important thing is to pick one style and use it consistently. If...

And in F95 and later, you can explicitly declare a function PURE, in which case its body is prohibited from having (most) side effects, which is (sometimes? often?) enough for uses of it to be optimized.

Similarly in C for a standard 1 function like strlen() the compiler can know about it and handle it specially; it isn't required, though is permitted, to make standard library functions just plain library functions like user-written ones, as the earliest implementations (fitting in as little as 32K or so) did. It is true that a C compiler must buttume that a character object access can alias with almost anything else, unless you use (correctly!) the new in C99 'restrict' qualifier. In the very simple case upthread of a hash of the string contents it could safely optimize, although such cases are probably rare enough that compiler-writers might reasonably not put the effort into handling them. 1 You can override a library function within a translation unit only, where it must be visible if the compiler wishes to special-case it, but in the example upthread the standard semantics of strlen() were clearly intended.

- David.Thompson1 at worldnet.att.net

Thou shalt have no other gods before the ANSI C standard 1562
with kind report very surprising, Correct. AFAICT the most effective approach has been to do the following: * Formal proofs (ie: that maths stuff that hackers don't like). * Design...



Your Ad Here

List | Previous | Next

Thou shalt have no other gods before the ANSI C standard 1560

Alt Folklore Computers from Newsgroups

The #1 Usenet Provider on the Internet

Thou shalt have no other gods before the ANSI C standard 1558