On 07/26/11 15:08, Thomas Gahr wrote: > About private members: _if_ I ever used some special naming convention for > their names, it used to be m_foo but _foo is one letter less typing ;) > Either way I think it's up to you to decide that since it's really just a > matter of taste I guess and after all this project is your baby :) - unless > there is some rule that variables starting with underscores are reserved for > gcc's or libstdc++'s implementation or whatever.
That's the problem, exactly -- the _identifier is usually a reserved thing. Let's use the m_foo, then. > I'm not sure about private member functions, I've never seen any special > naming for those as far as I can remember. That's right, I don't think there's any real need for special naming of them. > One thing that hasn't been mentioned so far comes to my mind: Order of > includes: > > file Gui/SomeWidget.cpp: > > //"system" headers > #include<iostream> > > //Qt headers > #include <QtBla> > > //header for the class implemented here > #include "SomeWidget.h" // (1) > > //project headers > #include "Gui/Window.h" // (2) Yes, that's basically the order I like. Don't forget the space before the first '"' or '<'. I also prefer to include space after the '//'. > About (1): when writing a .cpp it comes naturally to #include the > corresponding .h right before all other project headers - should this be a > policy? I usually do that. > About (2): even though SomeWidget.cpp is in the same folder as Window.h I > tend > to explicitly write "Gui/Window.h" - gives a little more structure to this > part of the file. That's a great idea. > Btw: I read some time ago that obviously it is best practice to explicitly > specify the Qt-Module when including headers since this leads (lead? not sure > if this is still relevant) to build problems on Mac - i.e. #include > <QtGui/QWidget> instead of just #include <QWidget> - that never bothered me > though as I didn't (have to) care about my app being portable to Mac before... I've read that. Folks that build Trojita on Mac did not say that it was an issue for them, though. If you'd like to use that convention, please go ahead. Cheers, Jan -- Trojita, a fast e-mail client -- http://trojita.flaska.net/
signature.asc
Description: OpenPGP digital signature
