At 14:14 13.11.2002, Sascha Schumann wrote:
> You're right the compiler knows the size in the caller function but not > in ecalloc of cause. Shouldn't then ecalloc be a compiler define? > > #define ecalloc(num, size) \ > memset( emalloc(num*size), 0, num*size)It was like that until Aug 18th. A commit back then turned the fast macro back into a slow function again and added a division. With that kind of setup, the compiler has no chance to reduce and optimize the target code. By using emalloc+memset, we get compile-time reduction (no multiplication at run-time) and inlining for free. - Sascha
Agree but with one single addition if num and size are both constants then the compiler does the multiplication at compiletime. So the above define shouldn't have a run-time multiplication where not necessary. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
