List:Internals« Previous MessageNext Message »
From:Jay Pipes Date:March 11 2009 2:24pm
Subject:Re: MySQL University Session: Good Coding Style follow up
View as plain text  
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael Widenius wrote:
> Hi!
> 
>>>>>> "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
> explosions.

An example would work wonders here.  Otherwise, I will start to think
you're still thinking about compilers from >5 years ago :)

- -j
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkm3yYYACgkQ2upbWsB4UtFd8QCfW0M2eO+HHZBiwCC+alCiH4Zb
gsgAnAzd5INmdO3b0MkKSXNQhOhRA9bQ
=yBzx
-----END PGP SIGNATURE-----
Thread
MySQL University Session: Good Coding Style follow upKonstantin Osipov5 Mar
  • Re: MySQL University Session: Good Coding Style follow upRoy Lyseng5 Mar
    • Re: MySQL University Session: Good Coding Style follow upKonstantin Osipov5 Mar
      • Re: MySQL University Session: Good Coding Style follow upMichael Widenius8 Mar
    • Re: MySQL University Session: Good Coding Style follow upMichael Widenius8 Mar
      • Re: MySQL University Session: Good Coding Style follow upRoy Lyseng8 Mar
        • Re: MySQL University Session: Good Coding Style follow upMichael Widenius9 Mar
          • Re: MySQL University Session: Good Coding Style follow upJay Pipes9 Mar
            • Re: MySQL University Session: Good Coding Style follow upMichael Widenius11 Mar
              • Re: MySQL University Session: Good Coding Style follow upJay Pipes11 Mar
                • Re: MySQL University Session: Good Coding Style follow upMichael Widenius18 Mar
      • Re: MySQL University Session: Good Coding Style follow upStewart Smith17 Mar
  • Re: MySQL University Session: Good Coding Style follow upMARK CALLAGHAN5 Mar
    • Re: MySQL University Session: Good Coding Style follow upIngo Strüwing5 Mar
      • Re: MySQL University Session: Good Coding Style follow upMARK CALLAGHAN5 Mar
        • Re: MySQL University Session: Good Coding Style follow upIngo Strüwing5 Mar
          • Re: MySQL University Session: Good Coding Style follow upMARK CALLAGHAN5 Mar
            • Re: MySQL University Session: Good Coding Style follow upJay Pipes5 Mar
              • Re: MySQL University Session: Good Coding Style follow upMichael Widenius8 Mar
                • Re: MySQL University Session: Good Coding Style follow upJay Pipes8 Mar
            • Re: MySQL University Session: Good Coding Style follow upKonstantin Osipov5 Mar
              • Re: MySQL University Session: Good Coding Style follow upMARK CALLAGHAN5 Mar
              • Re: MySQL University Session: Good Coding Style follow upMichael Widenius8 Mar
    • Re: MySQL University Session: Good Coding Style follow upSergey Petrunia5 Mar
  • Re: MySQL University Session: Good Coding Style follow upDavi Arnaut5 Mar
    • Re: MySQL University Session: Good Coding Style follow upKonstantin Osipov5 Mar
      • Re: MySQL University Session: Good Coding Style follow upDavi Arnaut5 Mar
  • Re: MySQL University Session: Good Coding Style follow upJonas Oreland5 Mar
    • Re: MySQL University Session: Good Coding Style follow upKonstantin Osipov5 Mar
      • Re: MySQL University Session: Good Coding Style follow upJonas Oreland5 Mar
        • Re: MySQL University Session: Good Coding Style follow upshlomo.swidler5 Mar
          • Re: MySQL University Session: Good Coding Style follow upMichael Izioumtchenko5 Mar
        • Re: MySQL University Session: Good Coding Style follow upMichael Izioumtchenko5 Mar
        • Re: MySQL University Session: Good Coding Style follow upStewart Smith17 Mar
      • Re: MySQL University Session: Good Coding Style follow upMichael Widenius8 Mar
Re: MySQL University Session: Good Coding Style follow upKonstantin Osipov5 Mar
  • Re: MySQL University Session: Good Coding Style follow upMARK CALLAGHAN5 Mar
  • Re: MySQL University Session: Good Coding Style follow upMichael Widenius6 Mar
    • Re: MySQL University Session: Good Coding Style follow upKonstantin Osipov6 Mar
      • Re: MySQL University Session: Good Coding Style follow upMARK CALLAGHAN6 Mar
      • Re: MySQL University Session: Good Coding Style follow upMichael Widenius8 Mar