Hey,

2012/6/26 Mark Vender <markv...@yahoo.co.uk>:
> On 06/26/2012 05:31 PM, Bastien Nocera wrote:
>>
>> If we used enums, we would restrict the keysyms to the declared values.
>
>
> Well, C doesn't actually have such restriction.

Yes and no, if you assign an integer to a variable of an enum type,
and if this integer is not one of the value defined for this enum
type, then this is undefined behaviour in the C standard.


> It's impossible for an application to break when enum values are added. They
> end up as integers within the code anyway and unless their values change,
> API/ABI stays the same.

Again, the C standard has some gotcha there, a compiler is allowed to
use a char-sized integer or an int-sized integer to store an enum, so
sizeof of an enum type can change if you add more values to it, which
could be an ABI break. And this is not purely theoretical, I think
llvm does this.

Christophe
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list

Reply via email to