lock3 / meta

123 stars 11 forks source link

Ways to identify this compiler in client code #269

Closed Manu343726 closed 3 years ago

Manu343726 commented 3 years ago

Hi, I was wondering what would be the value of __clang__ macro for this compiler so I can check if I'm running through it, or if there's some other recommended mechanism, like doing __has_include(experimental/meta). Thank you,

DarkArc commented 3 years ago

We don't define any special macros to identify this work; I wouldn't say there's a recommended way to detect this either. I'm curious what your exact use case would be?

That said, __has_include seems reasonable, e.g.: https://cppx.godbolt.org/z/vfM3nb vs https://cppx.godbolt.org/z/8x8bh8

Manu343726 commented 3 years ago

I plan to write a backend for my tinyrefl library (https://github.com/Manu343726/tinyrefl) using your clang fork, to see how it would look like to integrate an std reflection metadata API and get rid of external parsing.

The check is required to see whether the backend is available and raise the proper diagnostic to the user if it's missing

DarkArc commented 3 years ago

Okay good to know, thanks for your interest, and please feel free to leave feedback with us about your experience. :)

Also a friendly reminder, please keep in mind things here are too a work in progress, and subject to change as things progress in the standardization process.

I'm going to go ahead and close this, as I think __has_include will satisfy your needs.

Manu343726 commented 3 years ago

I think __has_include() will do the job perfectly, thanks for your time.