On Sun, Mar 8, 2009 at 2:53 PM, Monty Taylor <[email protected]> wrote: > Jay Pipes wrote: >> Hi all, >> >> Monty recently brought up a good discussion/vote point on a merge >> proposal from Padraig, and I think I like his idea. Just want to get >> everyone's opinion on this and then we can add it to the style >> guidelines online... >> >> Basically, the rule would be: >> >> When in a *header file*, always use an explicit namespace prefix, like so: >> >> void myfunc(std::list some_list, drizzle::serialize::Table *some_table) >> { >> // blah, blah... >> } > > The bit above is the important one. Use of using inside of header files > can make thing more ambiguous as to what the interface really is, and > can also inject unintended name resolution changes into including files. > >> and in implementation files, use a single using namespace statement, > > _after_ all include statements, so as not to inject un-intended name > resolution issues into headers. > >> like so: >> >> using namespace std; >> using namespace drizzle::serialize; >> >> void myfunc(list some_list, Table some_table) >> { >> // blah, blah >> } >> >> Opinions?
+1 Monty encouraged me to follow this style when I first started submitting patches so I'm kinda used to it now :) The only issue I've encountered with this is when using some functions such as remove_if on Solaris, then the std:: prefix is necessary or a compilation error occurs. I don't remember exactly why that was? > > This one isn't _required_, although I'd like to adopt it anyway. Mainly > - we've got using statements, implementation files aren't included > elsewhere (at least, not any more thankfully) so we know what's going on > in them... so the code is hella-friendlier that way. > > Monty > > _______________________________________________ > Mailing list: https://launchpad.net/~drizzle-discuss > Post to : [email protected] > Unsubscribe : https://launchpad.net/~drizzle-discuss > More help : https://help.launchpad.net/ListHelp > _______________________________________________ Mailing list: https://launchpad.net/~drizzle-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~drizzle-discuss More help : https://help.launchpad.net/ListHelp

