Skip to content

[ML] Standardise on cmath header #33

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

Merged
merged 2 commits into from
Apr 3, 2018
Merged

[ML] Standardise on cmath header #33

merged 2 commits into from
Apr 3, 2018

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
Contributor

@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