Re: Thou shalt have no other gods before the ANSI C standard
From: Andrew Swallow (am.swallow_at_btopenworld.com)
Date: 02/27/05
- Next message: Andrew Swallow: "Re: Thou shalt have no other gods before the ANSI C standard"
- Previous message: Andrew Swallow: "Re: Thou shalt have no other gods before the ANSI C standard"
- In reply to: Hank Oredson: "Re: Thou shalt have no other gods before the ANSI C standard"
- Next in thread: Phil Carmody: "Re: Thou shalt have no other gods before the ANSI C standard"
- Reply: Phil Carmody: "Re: Thou shalt have no other gods before the ANSI C standard"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
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
- Next message: Andrew Swallow: "Re: Thou shalt have no other gods before the ANSI C standard"
- Previous message: Andrew Swallow: "Re: Thou shalt have no other gods before the ANSI C standard"
- In reply to: Hank Oredson: "Re: Thou shalt have no other gods before the ANSI C standard"
- Next in thread: Phil Carmody: "Re: Thou shalt have no other gods before the ANSI C standard"
- Reply: Phil Carmody: "Re: Thou shalt have no other gods before the ANSI C standard"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|