[gdal-dev] Starting a discussion on style and coding guidelines
Mateusz Loskot
mateusz at loskot.net
Fri May 6 14:47:18 PDT 2016
On 6 May 2016 at 21:55, Kurt Schwehr <schwehr at gmail.com> wrote:
> My belief is that for this particular proposal, we should not have the
> C++11/14 discussion unless the best overall solution requires a newer
> version of C++. The solution I propose to be the best works in C++03 and
> newer.
Simply, the initial proposal was quite confusing.
The 'title' said indicated it was "mostly focused on C++11/14 & C99/11",
while the content mentioned mostly the std::vector as malloc'ed arrays
replacement.
Considering current codebase, GDAL is written in C and compiled in C++.
The only major C++ feature used in GDAL is classes and polymorphism.
I'm not sure if the facts mentioned in the proposal, namely
"Want to focus on maintainability and readability of code",
is meant to be a fact or a goal.
If you ask any seasoned C programmer for opinion, I bet she will
consider GDAL codebase as clear and readable.
If you ask a C++ programmer, the answer might be different.
IMO, I doubt any C++11/14 feature will increase the current code,
unless it is considered to ditch many of CPL features and replace
them with C++ standard features (string bashing operations, string containers,
containers for other types, threading API, etc.).
Certainly, any new line to be written may benefit from auto,
constexpr, using, nullptr, range loops - but for a "C with classes"
codebase as GDAL, it would be cosmetic improvement, if any.
Surely, the override and final will help compiler to catch potential bugs.
Also, C++11/14 compilation mode is generally stricter, so it might
help to catch bugs.
Simply, the whole proposal is becoming vague.
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
More information about the gdal-dev
mailing list