J
jacob navia
Le 29/12/10 19:24, christian.bau a écrit :
Of course a cat isn't a cat. It is "felis domesticus".
How can you DARE just call it a cat?
YES, there is no overflow OF COURSE.
but... as you yourself said:
jacob
P.S. your idea of an argument to _overflow() is quite clever.
Thanks for that, I think I will change lcc-win for it,
since the generated
code is exactly the same as if you write
c = a+b;
if (_overflow())
-->
if (_overflow(a+b))
Looks much better and generates the same code:
movl a,%eax
movl b,%ecx
addl %eax,%ecx
movl $0,%eax
seto %al
Now, eax contains either 1 or zero depending on
the value in the overflow flag.
The pseudofunction _overflow() will just generate the
conditional jump, and the arguments will be evaluated as
normal function arguments that aren't pushed in the stack
See, you are lacking _precision_.
If an implementation of calloc written in C just multiplies its two
arguments of type size_t, there _cannot_ be an overflow. The result
can be a number that is much too small for (count) elements of (size)
bytes each, but it's not an overflow.
Of course a cat isn't a cat. It is "felis domesticus".
How can you DARE just call it a cat?
YES, there is no overflow OF COURSE.
but... as you yourself said:
> The result
> can be a number that is much too small for (count) elements of (size)
> bytes each
jacob
P.S. your idea of an argument to _overflow() is quite clever.
Thanks for that, I think I will change lcc-win for it,
since the generated
code is exactly the same as if you write
c = a+b;
if (_overflow())
-->
if (_overflow(a+b))
Looks much better and generates the same code:
movl a,%eax
movl b,%ecx
addl %eax,%ecx
movl $0,%eax
seto %al
Now, eax contains either 1 or zero depending on
the value in the overflow flag.
The pseudofunction _overflow() will just generate the
conditional jump, and the arguments will be evaluated as
normal function arguments that aren't pushed in the stack