[mapserver-dev] Modernizing code base: C99 and maybe C++ ?

Even Rouault even.rouault at spatialys.com
Fri Nov 29 09:11:50 PST 2019

On mercredi 27 novembre 2019 15:15:45 CET Seth G wrote:
> On the C89/99 choice, I've not written enough of either to have an opinion
> so 1++ on whatever you think is best for the future of the project.

I've just had a quick try on mapogcfiltercommon.c (now .cpp) in

I believe everyone, developer or not, can appreciate how the += operator makes the code:
1. smaller : += is more compact than msStringConcatenate()
2. clearer: our limited brain can concentrate more easily on the interesting high level logic.
3. and ... more secure. No need to make sure the buffer will not overflow,
   that it is nul terminated, that we increment properly iTmp, etc.

Actually this example is not randomly chosen. This would have avoided a past
vulnerability that we had to patch with 

(I'm not saying use of C++ makes you security immune automatically. Certainly not)

This also demonstrates this can be done in an incremental fashion, at
least sometimes...

> I think with a version 8 we should also consider:
> - upping the minimum required versions of all dependencies -
-  the page here
> [1] is likely out of date - increase minimum CMake version
> - increase minimum SWIG version
> - drop Python2 support

One way of addressing this would be to determine for example which version of
popular Linux distributions we want to support, look at the version of the
dependencies they support, and use that as our baseline.

Hint: CentOS/RHEL 7 would certainly to be the most constraining factor if we
aim at supporting "old-stable" releases. I see for example the EPEL 7 repo only ships
with GDAL 1.11 whereas we now require GDAL 2 for master.


Spatialys - Geospatial professional services

More information about the mapserver-dev mailing list