Re: strlen(), K+1: clarification
- From: Willem <willem@xxxxxxxx>
- Date: Fri, 22 Feb 2008 14:03:32 +0000 (UTC)
spinoza1111 wrote:
) He made the same mistake as me, and we are quite beyond apologies
) given his conduct. strlen is not in essence any slower than a math
) operation since it can be a single instruction whereas the math
) instruction is in many cases two operations (push the constant, do the
) math).
Do you seriously believe that each instruction takes the same amount
of time to process ?
The single instruction that strlen() might compile to will *still*
have to read the *entire* string to find the end.
) No scientific generalization, only folklore round de campfire,
) declares that strlen *must* be slower than subtracting a constant on
) all possible machines.
IT IS! What part of O(N) don't you understand ?
) When my mistake was pointed out to me, with the
) vilest sort of rudeness, I mentally categorized it, I filed it the
) *** away, as "OK, C sucks, don't evaluate invariants OF ANY SORT in a
) for in cases where you need speed").
In other words, you didn't actually listen. Your fault.
) I saw Clive's mistake as the same overall mistake,
I hope you realize now that it is not in fact the same mistake.
You know, if you had just admitted, all the way back in the beginning, that
you didn't know that strlen(), in C, is an O(N) operation, that you also
didn't know that the C for() loop evaluates the guard each time through the
loop and that, yes, indeed, you should try to avoid using O(N) operations
inside a loop, then all of this nonsense would not have been necessary.
A simple "Oh, I see. You're right." would have been enough.
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
.
- Follow-Ups:
- Re: strlen(), K+1: clarification
- From: Randy Howard
- Re: strlen(), K+1: clarification
- References:
- strlen(), K+1: clarification
- From: spinoza1111
- Re: strlen(), K+1: clarification
- From: Ben Bacarisse
- Re: strlen(), K+1: clarification
- From: spinoza1111
- strlen(), K+1: clarification
- Prev by Date: Re: Dealing with ad hominem attacks in comp.programming
- Next by Date: Re: strlen(), K+1: clarification
- Previous by thread: Re: strlen(), K+1: clarification
- Next by thread: Re: strlen(), K+1: clarification
- Index(es):