Hi!

Thomas Förster wrote:
> The reason is a wrong return type on FGAirport::getId(). Should be const 
> string& instead of string (which does a local copy that is then referenced in 
> FGAirportDynamics::getId())

Maybe that's a dumb question (which would be embarassing, because I
typically think of myself as a good C++ programmer), but why use a
reference in the return type anyway instead of the "real thing"? If a
copy is created anyway, the "&" doesn't have any advantage, or am I
missing something?

"const string&" would only make sense if a string was returned which is
typically stored in the object and should _not_ be copied, e.g. in a
getter-method.

Am I missing something?

Cheers,
Ralf

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to