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

compiling with MSVC #8

Closed
rlatowicz opened this issue Aug 28, 2018 · 3 comments
Closed

compiling with MSVC #8

rlatowicz opened this issue Aug 28, 2018 · 3 comments

Comments

@rlatowicz
Copy link

Hi Keith,
Thanks for sharing your library.

Changing the define at the bottom of statslib_options.hpp,
from:
#define __stats_pointer_settings__ __restrict__

to:
#define __stats_pointer_settings__ __restrict

will make the library compatible with MSVC as well as GCC/Clang.

Thanks again,
Rafael.

@kthohr
Copy link
Owner

kthohr commented Aug 28, 2018

Hi @rlatowicz

Let me know if the new version works for you.

#ifndef __stats_pointer_settings__
#if defined(__clang__) || defined(__GNUC__)
#define __stats_pointer_settings__ __restrict__
#elif defined (_MSC_VER)
#define __stats_pointer_settings__ __restrict
#else
#define __stats_pointer_settings__
#endif
#endif

@rlatowicz
Copy link
Author

That's great.

I wasn't as clear as I could have been.
GCC & Clang are happy with either,
__restrict__
or
__restrict

See here:
https://gcc.gnu.org/onlinedocs/gcc/Restricted-Pointers.html

So using,
__restrict

will work with GCC, Clang & MSVC.
No need to differentiate.

Thanks again.
Greatly appreciated.

@kthohr
Copy link
Owner

kthohr commented Aug 28, 2018

Hmm. I've experienced different behavior with Clang in the past, but perhaps this is not longer the case. I'll leave it as-is for now but thanks for alerting me to this!

@kthohr kthohr closed this as completed Aug 28, 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

No branches or pull requests

2 participants