I'm using __get_cpuid()
to get info on the x86
and x86_64
processors my programs run on. With GCC on Linux and Mac OS, it seems to compile and run OK without include any header, but how portable is that? Would it work with other compilers? Should I include a header for that?
How portable is __get_cpuid?
Asked Answered
You should include that anyway. Calling a function without a known prototype is illegal in C99. –
Platto
@WTP: Being a built-in function, it does not require a prototype. There is no header file to include. The C99 standard does not apply because it is a language extension. –
Interpellant
@Dietrich Epp My bad, I didn't know it was a language extension. That wasn't mentioned in the question. –
Platto
It has two leading underscores. Any leading underscore at all is a big hint that the variable or function is not portable.
Is there a portable C code (Better as Template Library) which allows detecting CPU features? For instant if AVX is supported or not. –
Parakeet
© 2022 - 2024 — McMap. All rights reserved.