On Mon, Jun 13, 2011 at 10:53 PM, Gordon Allott <[email protected]> wrote: > Hi all, > > So C++0x, the latest C++ standard is just about ready for final, and its > damn sexy. G++ supports it with the -std=x++0x flag but before we go > ahead and start putting crack in to unity, I'd like to hear reasons that > we shouldn't start using C++0x stuff like lambda's in unity. speak now > or I’m gonna add lambda's to everything I see. > > I don't expect all of you to have read the C++0x spec, but some > highlights are: > > Type inference with the auto keyword, kind of like vala's var keyword, > you can negate the need to strongly type a variable if you are not sure > what a function is going to receive, dangerous, but useful with template > programming. > > >> auto some_strange_callable_type = boost::bind(&some_function, _2, > _1, some_object); >> auto other_variable = 5; " > >
A quick note on auto here: The fact that we want to use auto isn't a licence to go crazy with it, instead in the coding style guidelines we will have something like: // Don't use it here auto i = 16; auto j = 16.0; Only use it when you know very well what your're expecting: std::list <unity::component::foo::bar::reallylongnamebaz> bazzes; // Bad std::list <unity::component::foo::bar::reallylongnamebaz>::iterator it = bazzes.begin(); // Good! auto it = bazzes.begin () > > Thoughts, opinions? yay? nay? +1? -1? > -- > Gordon Allott > Canonical Ltd. > 27 Floor, Millbank Tower > London SW1P 4QP > www.canonical.com > > > _______________________________________________ > Mailing list: https://launchpad.net/~ayatana-dev > Post to : [email protected] > Unsubscribe : https://launchpad.net/~ayatana-dev > More help : https://help.launchpad.net/ListHelp > > -- Sam Spilsbury _______________________________________________ Mailing list: https://launchpad.net/~ayatana-dev Post to : [email protected] Unsubscribe : https://launchpad.net/~ayatana-dev More help : https://help.launchpad.net/ListHelp

