[gdal-dev] Minimum supported C and C++ standards

Mateusz Loskot mateusz at loskot.net
Mon May 9 02:33:38 PDT 2016


On 7 May 2016 at 19:10, Kurt Schwehr <schwehr at gmail.com> wrote:
>>
>> If we move to a later C++ standard, or even use features of C++98 we
>> currently
>> don't use, I'd advocate for using things that are obviously making the
>> code
>> better / more readable. Honestly who finds that
>> "std::unique_ptr<int *, std::function<void(char *)>> Vals(CPLCalloc(256,
>> 0),
>> CPLFree);" is obviously more readable, efficient and less error prone than
>> "std::vector Vals(256,0)" ?
>>
>
> This is cart before the horse but... as fast as I can so expect typos.  Now
> just think of a ~1K long function or method with tons of instances and lots
> of places to bailout successfully or as failures.  We have > 9K
> free/CPLFree/CPLdelete/CPLDestroys that could be < ~100.
> [...]

...the very long story short, your desire is to introduce the RAII idiom
across GDAL codebase. Awesome!
I'm sure 99% of GDAL committers will welcome this idea.
Then, **next** question is how we want to implement it:
using C++11+ features, home-brewed smart pointer class(es), etc.

Upgrading to C++11+ just for the sake of upgrade, makes little sense to me.
Especially if folks are not certain about it, don't use those features daily,
don't feel comfortable...it may cause more harm.

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net


More information about the gdal-dev mailing list