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

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


Your Ad Here

Your Ad Here

Perhaps some have taken a more generic path, but I thought the question was fairly specific:

Will a C compiler (with or without optimizer) hoist a strlen() call out of a for loop, particular the body of the "for(...)" itself?

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...

I prefer empirical evidence to theory on this, and so far, half a dozen compilers have answered "no" to this question. Again, if anyone can point to one that answers "yes", I'd like to know.

The more important question of course is that if the outcome is compiler dependent (at best) and likely to fail on the most commonly used C compilers in existence, why would a programmer *not* hoist the call themselves?

I am afraid that the answer may be that far too many people, comprised of students, textbook authors, teachers and even experienced developers think that it will, and never bother to find out for themselves.

Thou shalt have no other gods before the ANSI C standard 1559
On Sun, 27 Feb 2005 02:05:23 GMT, Brian Inglis Not according to the C standard, although it may work on some implementations...

You can add the whole "what does volatile really do?", and the endless debates on what magical properties it may or may not convey on an object (C sense) to this debate as a corollary.

-- Randy Howard (2reply remove FOOBAR) "Rally Mohawks, and bring your axes and tell King George we'll pay no taxes"



Your Ad Here

List | Previous | Next

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

Alt Folklore Computers from Newsgroups

The #1 Usenet Provider on the Internet

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