[glideplan_swproj] Re: [glideplan_swproj] Re: Coding practices

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

Ok, I understand :)
Reference counting, copy-on-write, ...lot of magic.
So we can return "shared classes" by value.
But for passing parameters, I advise to use const references (Qt does it the 
same way).

T.

> ------------ Původní zpráva ------------
> Od: Kuba Marek <blue.cube@xxxxxxxxx>
> Předmět: [glideplan_swproj] Re: Coding practices
> Datum: 16.1.2012 19:17:51
> ----------------------------------------
> http://doc.qt.nokia.com/4.7-snapshot/implicit-sharing.html :-)
>
> > I'm looking at Qt funtions style.
> > They use value passing for returning even QString.
> > We can do it similar way - it is comfortable.
> > But for bigger objects, we should use pointers/references.
> >
> > T.
> >
> > > ------------ Původní zpráva ------------
> > > Od: Tomáš Zámečník <pulcik@xxxxxxxx>
> > > Předmět: [glideplan_swproj] Re: [glideplan_swproj] Coding practices
> > > Datum: 16.1.2012 19:05:39
> > > ----------------------------------------
> > > It's not a signal fot rewriting all.
> > > ...If it is necessary, we should do it with some refactoring.
> > >
> > > T.
> > >
> > > > ------------ Původní zpráva ------------
> > > > Od: Tomáš Zámečník <pulcik@xxxxxxxx>
> > > > Předmět: [glideplan_swproj] Coding practices
> > > > Datum: 16.1.2012 19:03:00
> > > > ----------------------------------------
> > > > 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:
> > > > http://www.freelists.org/list/glideplan_swproj
> > > >
> > > >
> > > >
> > >
> > > To visit archive or unsubscribe, follow:
> > > http://www.freelists.org/list/glideplan_swproj
> > >
> > >
> > >
> >
> > To visit archive or unsubscribe, follow:
> > http://www.freelists.org/list/glideplan_swproj
>
>
>

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

Other related posts:

  • » [glideplan_swproj] Re: [glideplan_swproj] Re: Coding practices - Tomáš Zámečník