[Proj] Use of C++

Even Rouault even.rouault at spatialys.com
Sun May 27 14:00:40 EST 2018


Joaquim,

> 
> I am sorry but I don't think we can conclude that. The proponents naturally
> are in favor and, given that they will do the work, that is a strong
> argument. However, there is often forgotten price to pay when a code moves
> from C to C++ that is the reduction of potential contributors.

We are speaking here about new code for new functionality. Existing code for 
now would remain in C.
Your argument could be reversed: I'm a contributor to other C-written OSGeo 
projects where I would certainly contribute more to one project in particular, 
if dealing with its aging C code base wouldn't discourage me all the time 
(complicated memory management, painful string usage, etc...)

> Speaking
> only from myself, but knowing I'm not alone, C++ is an awfully complicated
> language

Agreed that mastering the whole C++ standard(s) can be awfully complicated. 
Subset of it can be much more manageable.

> that it was really
> important but there were times I tried to contribute to GDAL but hit the
> C++ wall.

Huh really? GDAL use of C++ is just C with classes, nothing too fancy 
generally ;-)

> 
> I also find the embedded systems argument a valid one but have poor
> knowledge on the subject. 

I'd bet people working in embedded systems heavily constrained like 
microcontrollers don't even use existing proj unmodified. They probably cut it 
down to the few projections they must use, have to replace/remove all the 
access to resource files, etc. Anyway the Linux kernel is written in C, but 
there are a number of low-cost platforms that cannot run recent version of it 
because it is too big and there are tensions in its community to know if it 
must try to accomodate for those uses

I believe that most contributors and users of proj are in the desktop/server 
segment. We can't address all potential use cases.

> What I have read here and there is that C++ codes
> makes bigger and more resource demanding needs that those made with C.

That depends. This is not a general truth. It can also produce more optimized 
code.

> 
> That said, and as I mentioned in beginning, those that will implement the
> new features have ofc the main word.

Honestly I can't imagine coding in C all those new functionalities. Basically 
the standards we want to implement is object oriented. I would spend too much 
time reimplementing object-like concepts with lot of verbose and error-prone C 
constructs (in a previous life, I've developed a complex project using GLib 
GObject C model [1]. It worked, but at what price...)

Even

[1] https://developer.gnome.org/gobject/stable/

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the Proj mailing list