Skip to content

Use osg::PI in preference to M_PI#1

Merged
robertosfield merged 1 commit intorobertosfield:masterfrom
AnyOldName3:msvc
Jun 17, 2025
Merged

Use osg::PI in preference to M_PI#1
robertosfield merged 1 commit intorobertosfield:masterfrom
AnyOldName3:msvc

Conversation

@AnyOldName3
Copy link
Contributor

The C++ spec doesn't require cmath to provide M_PI etc. libc++ and libstdc++ both do automatically, but Microsoft's STL fences it off behind a define as they're not reserved names, so could conflict with spec-compliant user code.

@robertosfield
Copy link
Owner

The OSG provide PI implementation so this could be used instead without requiring a platform specific hack

The C++ spec doesn't require cmath to provide M_PI etc.
libc++ and libstdc++ both do automatically, but Microsoft's STL fences
it off behind a define as they're not reserved names, so could conflict
with spec-compliant user code.

However, osg always provides osg::PI
@AnyOldName3 AnyOldName3 changed the title Add _USE_MATH_DEFINES before cmath Use osg::PI in preference to M_PI Jan 10, 2024
@AnyOldName3
Copy link
Contributor Author

I noticed this never got sorted while tidying up some old browser tabs, so I've changed this to use osg::PI instead of M_PI.

@robertosfield robertosfield merged commit 93058ea into robertosfield:master Jun 17, 2025
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.

2 participants