M
Mark McIntyre
Mark McIntyre a écrit :
Knowing the length is necessary for so many situations that in MOST
cases you will end up calling strlen explicitely or implicitely
I disagree. You're once again generalising from your own extremely
limited experience to make wild sweeping statements about everyone
else's experience.
In many cases you need to pass the string to another function.
In most cases you need to pass the length or the called function must
call strlen.
This doesn't follow even slightly. Stop putting up spurious arguments.
To know if a string fits in a buffer you must know its length.
No, you need merely know that it cannot be larger than the buffer. I
don't expect you to understand the difference.
It is obvious that you can keep the length to avoid this
problems as heathfield says. But... if you need to keep the
length why not use a counted strings package anyway???
If you need to handle div/0 sometimes, why always perform the check?
??? Maybe a typo? You mean 1e+0 probably.
Buy a new calculator.
Maybe, anything can be exaggerated by did you find that code
crashing with division by zero?
Dur, it was impossible for it to crash with a div/0 error.
Maybe, but it doesn't hurt so much to be careful in
high reliability code...
In point of fact it hurt considerably because our pricing calculator
was slower than everyone else's to the extent that we missed deals.
Yes, it may be 0.0001% less efficient but maybe he did not see
"efficiency" as a higher goal than SECURITY!!!
Now you're being silly. Only an idiot makes remarks like that.
Never said otherwise
Actually, you have repeatedly said exactly that.
You misunderstand. I was saying the usage of normal C functions in
contrast to operator overloading the '+' operation.
Ah, right, so you mean in some other language which has operator
overload. I thought you were talking about C.
Maybe.
1) lcc-win32 allows you to test for overflow, and the speed diffeerence
is almost zero when the compiler does it.
"almost zero". Mhm. Multiply by 10e12. Still almost zero?
2) I am improving the operator overloading part, allowing inline and
assembly modules, so basically you will be able to do the overflow
test with almost no overhead.
I have no problem with you doing this, but don't call it C please.
--
Mark McIntyre
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan