Why is ptrdiff_t a volatile?

Toby Douglass toby@winterflaw.net
Mon Oct 1 09:31:00 GMT 2018


On 01/10/2018 11:10, Marc Glisse wrote:
> On Mon, 1 Oct 2018, Toby Douglass wrote:
> 
>> Good morning/afternoon/evening, all.
>>
>> I've been writing some position independent data structure code.
>>
>> As such, I've been using ptrdiff_t.
>>
>> I've just noticed, while compiling, that my GCC (6.3.0) has ptrdiff_t 
>> as a volatile long int.
> 
> I doubt gcc does that. More likely your code has a broken macro 
> somewhere. You don't provide enough information for us to help more...

I thought I'd given enough for the question :-)

But I think you might be right indeed.

I've just had another line of output from GCC when it's unhappy with my 
code, which is this;

"note: expected ‘lfds720_pal_uint_t * {aka long long unsigned int *}’ 
but argument is of type ‘ptrdiff_t * {aka long int *}’"

Now before I was being told a ptrdiff_t was a volatile long int.

It looks like if I add volatile to a type, it turns up in the "aka".

I was not expecting this - I thought the aka would be the underlying 
type, sans qualifiers.



More information about the Gcc-help mailing list