-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider using C++ for the internals of shapelib #34
Comments
This one is already C++: https://github.com/fulcrumapp/shp-ruby/tree/master/ext/shp |
I was thinking about starting with the bin targets as they aren't linked against. And then probably with contrib first But none of this should happen fast. I'd rather have unit testing in place before doing anything major. And it would be good to set up a release process and cut a branch point before doing this. That was, there is a place for fixes to for folks who can't switch to C++11 (which is where I assume this switch would go first) |
We are currently defining this in a new RFC: https://trac.osgeo.org/grass/wiki/RFC/7_LanguageStandardsSupport Citation: "However, C++11 is at this date in general considered the standard and until compelling reasons argue otherwise, the C++11 standard should be policy of the GRASS GIS project." (perhaps @metzm, @nilason or others still have additions here) |
In GRASS, we use a customized subset of shapelib which is only used to handle dbf files. Thus using C++ for the internals of shapelib does not immediately affect GRASS. If shapelib moves from C to C++, GRASS will decide when it is appropriate to follow this change and update its own copy of shapelib. In short, no objections from my side as GRASS developer maintaining the local copy of shapelib (ok, last change was 2016) in GRASS. |
Sorry, why change a perfectly lovely pure C library to a C++ library? |
That's a reasonable question to ask why C++ for the internals of shapelib. However, I can't say I'd call shapelib lovely. Some partial thoughts: The internal code is very hard for me to follow. It might be correct, but it's not obviously correct as I read it. I can use some very boring parts of C++ to make the code more robust and be much clearer in what it's doing. None of these changes would be exposed to existing users of the library. This is internal only. I have no intension of altering the existing API. Some of the things that would make parts of the code much more compact, more capable, and hopefully easier for the compiler to optimize:
Things I am proposing to not include:
Starting with some of the binaries, especially in contrib would likely be best. Some of the programs look to be partially completed ideas. Having the C++ stdlib available makes flushing out some of these easier. For C++ users (who know what we are getting into), we could design a common C++ API that is optional and separate. There are several floating around that can't be contributed back to the project. It would be nice to provide one to shapelib that is okay for anyone to opt into. This doesn't require the internals of shapelib be C++, but it does make it easier. Other thoughts definitely welcome and I'm not expecting to get to this any time soon. |
Sounds OK in principle I suppose. We have our copy in-tree and probably won't change that. We managed to maintain a pure-C stance for a long time, though that eroded in the last cycle. As long as the API doesn't change and features don't leak in sounds good to me. |
Shapelib the library already compiles pretty cleanly as C++. What do people think about making that always the case. I propose keeping the API as C, but we can then have things like constexpr and a cleanup class that would make the code easier to follow. Things I'm thinking about:
#25 talks about these:
Thoughts?
The text was updated successfully, but these errors were encountered: