Skip to content
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

Make util compilable with C++ #162

Merged
merged 1 commit into from
Aug 25, 2017
Merged

Make util compilable with C++ #162

merged 1 commit into from
Aug 25, 2017

Conversation

jokva
Copy link
Contributor

@jokva jokva commented Aug 21, 2017

Task

Compile util with g++

Approach

Renamed all util/*.c files to .cpp and compiled with g++. Lots of errors, most of them crying about implicit void* casts.

As a consequence, some extern Cs are added and fixed.

The patch isn't warning free with C++, but does compile and tests do work.

Pre un-WIP checklist

  • Statoil tests pass locally

@joakim-hove
Copy link
Contributor

Will it continue to build and compile with C - or is this a one-way-street?

@jokva
Copy link
Contributor Author

jokva commented Aug 21, 2017

It's still valid C, and it will be for quite a while.

@jokva jokva changed the title Libutil c++ Make util compilable with C++ Aug 21, 2017
@jokva
Copy link
Contributor Author

jokva commented Aug 21, 2017

Oh, and I should add, the first commit in this series fixes a problem with the version_* functions returning non-const pointers to static strings, which is a violation in C++. I don't think it is in C, but it should be cleaned up anyway. It shouldn't break binary compatibility in any way, unless downstream users assign these to non-const pointers (which, I'd argue, was always a bug).

@joakim-hove
Copy link
Contributor

As I understand it: These are changes to the source and header files which allow compilation with a C++ compiler, but the build system will still compile as C? In that case this should be merged right away - as soon as the merge conflict is resolved.

@jokva
Copy link
Contributor Author

jokva commented Aug 24, 2017

As I understand it: These are changes to the source and header files which allow compilation with a C++ compiler, but the build system will still compile as C? In that case this should be merged right away - as soon as the merge conflict is resolved.

100% correct.

Make util compilable with C++, mostly by adding explicit casts from
void* to some target type.
@jokva
Copy link
Contributor Author

jokva commented Aug 24, 2017

Travis didn't want to restart.

@jokva jokva merged commit 92a7438 into equinor:master Aug 25, 2017
@jokva jokva deleted the libutil-c++ branch August 25, 2017 07:06
@joakim-hove joakim-hove mentioned this pull request Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants