On Fri, 5 Jan 2018, Kurt Schwehr wrote:

* Passing char *psz yada all over the place in pure C++ code.  A const
std::string is usually not a noticeable expense and is a lot safer
* CPLString when std::string will do just fine.  And we can write free
functions to operate on strings.  I'm generally bothered by subclassing of
std::string as CPLString.  After reading large amounts of C++ code, I think
it adds more confusion than it ever helps over having clean free
functions.  Interop and analysis with CPLString's is no fun.

https://stackoverflow.com/questions/6006860/why-should-one-not-derive-from-c-std-string-class

Can you point me to some good examples of good pure C++ code in GDAL
- ideally driver code ? The driver tutorial
  http://www.gdal.org/gdal_drivertut.html
is full of pszFilename and other psz variables.

When I taught myself C++ in 1992 std::string did not exist,
and my gdal work is my only C++ practice since 1993.
In my exploration of gdal code I have seen very little use of std::string
and plenty of CPLString; it would be a great help to have good examples to copy.

--
Andrew C. Aitchison                                     Cambridge, UK
                        and...@aitchison.me.uk


_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to