nemequ/portable-snippets

`__has_builtin(__debugbreak)` does not exist in code nature, what is this?

Challanger524 opened this issue · 2 comments

This is reaching back into my memory a bit, but __debugbreak is an MSVC intrinsic. I think some compilers based on clang which strive for MSVC compatibility (the new version of icl comes to mind, I forget what it's called) implement it, but it may have just been hopeful since __debugbreak does exactly what we want here.

__has_builtin is not present in MSVC so it is much more clear to test __debugbreak() presence via __has_include(<intrin.h>), if compiler supports of course

#if __has_include(<intrin.h>)
#  include <intrin.h>
#  define BREAKPOINT() __debugbreak()
#endif

some compilers based on clang which strive for MSVC compatibility

that is a narrow range of (a single?) compiler(s)