Marcus Boerger wrote:
Overall you do a ton of 'struct * const var' which only means that you are
going to copy the pointer explicitly. Now functions that use a pointer in a
loop and increment it cannot optimize the code anymore and are forced to use
an additional real variable on the stack. So unless you have a very smart
compiler, the result is an increased stack size. Generally speaking I prefer
const on the reight and mid (between *'s) only. But others prefer it to denote
that not even the passed in pointer gets modifed and this sometimes even makes
debugging easier.

That's not necessarily true. In contrast to the volatile qualifier, the const qualifier in this context is just a semantic thing. So if your function has a immutable argument variable, it probably gets compiled a procedure that receives the argument in the registers and use it mutatively as long as no side-effects are possible. (of cource how it compiles depends on the target platform)

Having that said, I don't think it makes any sense to make pointer variables immutable, while marking the referent immutable greatly reduces tiny errors. Compilers are often smarter in this case.

Moriyoshi
--
Moriyoshi Koizumi <[EMAIL PROTECTED]>

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to