Re: Thou shalt have no other gods before the ANSI C standard

From: Andrew Swallow (am.swallow_at_btopenworld.com)
Date: 02/27/05


Date: Sun, 27 Feb 2005 17:54:33 +0000 (UTC)

Hank Oredson wrote:
[snip]
>>1. recomputing strlen on every iteration. Ugh.
>
>
> Won't the compiler find that it is invariant and fix it? :-)

No. strlen() is a subroutine. By default procedures are assumed to
return different values each time. The use of that construction tells
the compiler that the programmer *expects* a different value to be
returned and *wants* it to be called each time. Replacing strlen() by
getc() shows you why.

Andrew Swallow



Relevant Pages

  • Re: Exit Sub not exiting
    ... After trying this, then deleting the subroutine, ... Judy Hopkins ... This happened once before in another workbook, ...
    (microsoft.public.excel.programming)
  • Re: Use of subroutines
    ... Go tos are not evil. ... >I still maintain that a subroutine is first and foremost a GOTO ...
    (comp.lang.fortran)
  • Re: Two COBOL questions
    ... -Steve Comstock ... Easier to use CEEENV than calling the C subroutine putenv(), ...
    (bit.listserv.ibm-main)
  • Re: Can this be more efficient?
    ... it's not a good idea to use & when calling a subroutine. ... This was necessary for Perl4 and before, but that is at least 10 years ...
    (comp.lang.perl.misc)
  • Re: Proposal: INHERIT, NOINHERIT
    ... <snip a bunch> ... I just came across a case where I added a module parameter where one subroutine already had a DP variable. ... Intel Fortran does the same in test2, but test1 complains that i is implicit. ...
    (comp.lang.fortran)