-----BEGIN PGP SIGNED MESSAGE-----
Michael Widenius wrote:
>>>>>> "Jay" == Jay Pipes <Jay.Pipes@stripped> writes:
> Jay> -----BEGIN PGP SIGNED MESSAGE-----
> Jay> Hash: SHA1
> Jay> Michael Widenius wrote:
> Roy> Templates are already introduced - they need guidelines for when and why.
>>> Templates are fine to use as long as they are used only to remove
>>> casts in the code, not to generate code.
> Jay> Templates remove casts by generating code.
> One line for one line is fine (the same way as a define).
Actually, templates generate *less* code than a similar define, because
defines are *always* expanded, and templates (depending on the
compiler's implementation) usually only generate code when the linker
actually sees the template used for a specific type.
> And just enforcing types doesn't actually generate any assembler code
> when comparing with the original code; It just removes compiler checks.
And thus makes the code less safe and more error-prone.
> As long as this is the case, tools like gcov and gdb etc works fine.
> Things starts to fall appart when you have templates that generates
> many lines of code as then you can't be sure what code are used and
> debugging also gets to be more difficult.
I agree that debugging gets more, say, verbose. :) But I'm always able
to see in GDB what code is being executed...
> Not forgetting about code
An example would work wonders here. Otherwise, I will start to think
you're still thinking about compilers from >5 years ago :)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----