How to clear compile error when using rdrand64_step due to typedef'ing a 64-bit type?

Marc Glisse marc.glisse@inria.fr
Sat Aug 20 11:09:00 GMT 2016


On Fri, 19 Aug 2016, Jonathan Wakely wrote:

> On 19 August 2016 at 09:53, Jonathan Wakely wrote:
>> On 19 August 2016 at 09:07, Jeffrey Walton wrote:
>>>> You've basically gone chasing after some unrelated definition (that of
>>>> uint64_t) which has nothing to do with _rdrand64(), looking at
>>>> unrelated implementation details of that different type, and the
>>>> simple solution is to just use the type in the function declaration.
>>>
>>> That's how Intel documents it.
>>
>> They document it as unsigned __int64 but that's not a standard type.
>>
>> That's not a standard type. You found some definition of __int64 in a
>> different set of GCC headers and chased that, but there's no guarantee
>> that the header you looked in defined it consistently with how it's
>> used in the Intel docs.
>>
>>> A long time ago I was told to use Intel's documentation because GCC
>>> does not provide it (cf.,
>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=68081).
>>
>> GCC might not document the function, but the header unambiguously
>> defines the function signature, and it takes unsigned long long*.
>
> Arguably the GCC intrinsic should use uint64_t* but it doesn't, so the
> answer to your original question is still to simply use the right
> type. And the right type was shown in the error messages you quoted in
> your first mail.
>
> If a function is declared to take X* and you get an error when passing
> Y* the solution is to pass X* instead.

We could overload the function in C++ in 64-bit mode, but that may break 
code that tries to use a function pointer.

-- 
Marc Glisse



More information about the Gcc-help mailing list