tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: New feature-testing macros in <sys/cdefs.h>



On 4 Feb, 2015, at 15:00 , Kamil Rytarowski <n54%gmx.com@localhost> wrote:
> Any comments? Someone for or against of use of these macros?
> 
> I'm about to propose a library for overflows, which reuses these symbols,
> instead of depending on the hard-coded Clang checks.
> 
> Every compiler is free to support this or that builtin,
> without playing a role of GCC/Clang.

It's a bit hard to have an opinion since I write code that I expect to
be compiled with gcc at least as often as clang.  I generally deal with
this by trying to only use features that I expect both clang and gcc to
support, which probably means I wouldn't use those macros since only clang
really supports them.  The definitions you want to add only return the
right result in both compilers if you are asking about a builtin that
clang has and gcc doesn't, which might be your case but doesn't really
avoid hard-coded compiler checks in all the other cases.

Dennis Ferguson


Home | Main Index | Thread Index | Old Index