[glideplan_swproj] Coding practices

  • From: Tomáš Zámečník <pulcik@xxxxxxxx>
  • To: glideplan_swproj@xxxxxxxxxxxxx
  • Date: Mon, 16 Jan 2012 19:02:34 +0100 (CET)

Good evening to all,
I think that (beside style checker validation) we should keep some coding 
practices.

Following comes in my mind:

* For passing parameters (except elemtary types) should be used reference 
instead of value.
e.g.: void setName(const QString &name) instead of: void setName(QString name)

* Similarly big structers shouldn't be returned as a value (use out parameter 
instead)
e.g.: void getList(List *numbers) instead of: List getList()
...the best version is in my opinion: void getList(List &numbers), but our 
style-checker doesn't allow it.
(There is bug in style checker - it doesn't allow non-const reference for first 
param, but allows for others)

* Comments for methods should be in header file instead of cpp.
Interface is then specified by commented method headers (separated from 
implementation)
Cpp is sometimes inaccesible (when using precompiled libraries) ...I know, it's 
not our case,
but we should use one style.

T.

To visit archive or unsubscribe, follow:
//www.freelists.org/list/glideplan_swproj

Other related posts: