Skip to content

Conversation

@tveasey
Copy link
Contributor

@tveasey tveasey commented Apr 3, 2018

Following on from #32. This switches to use the cmath rather than math.h header. This only guaranties to declare special maths functions in the std namespace, so this also adds std:: qualification on existing calls. The rationale for this is that 1) math.h is now deprecated for use in C++ code, 2) increasing numbers of special functions are becoming available only in the cmath (see for example these in C++17).

Copy link

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This shows up quite a lot of files where we were relying on an indirect include of math.h and still are for cmath, but that's not a problem introduced by this change.

@tveasey
Copy link
Contributor Author

tveasey commented Apr 3, 2018

Yes, I thought the same.

I think we have quite a few implicit include dependencies, aside from these. On another project on which I worked, we wrote a tool to push down headers as far as possible through the include DAG, whilst checking compilation. Aside from avoiding implicit includes, it was also useful for reducing overall compile time. This might be something to consider at some point.

Since it is clear in which files the cmath header is missing reviewing this change. I'll address these ones now.

@tveasey tveasey merged commit 29a3567 into elastic:master Apr 3, 2018
tveasey added a commit that referenced this pull request Apr 4, 2018
This switches to use the cmath rather than math.h header. This only guaranties to declare special  functions in the std namespace, so this also adds std:: qualification on existing calls.
droberts195 pushed a commit that referenced this pull request Apr 23, 2018
This switches to use the cmath rather than math.h header. This only guaranties to declare special  functions in the std namespace, so this also adds std:: qualification on existing calls.
droberts195 pushed a commit that referenced this pull request Apr 23, 2018
This switches to use the cmath rather than math.h header. This only guaranties to declare special  functions in the std namespace, so this also adds std:: qualification on existing calls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants