AW: Correct way to express to the compiler "this does not get clobbered"?

David Brown david.brown@hesbynett.no
Sat Dec 5 19:07:16 GMT 2020


On 05/12/2020 18:29, Andrea Corallo via Gcc-help wrote:
> David Brown <david.brown@hesbynett.no> writes:
> 
> [...]
> 
>>  There is no way in C to say that there can't be anything else that
>> changes the object.
> 
> I think it would be nice to have, if not in C at least in GCC.
> 
>   Andrea
> 

Agreed.  But I think there are so many possible things about constness
that it would be nice to have, that it could quickly get out of hand.

I'd really like a way to tell the compiler that a given object gets set
once during some early function in the program, and can never change
after that.  But I can't think of any good syntax for that.



More information about the Gcc-help mailing list