Re: Strict aliasing, yes or no?
- Date: Wed, 19 Apr 2017 08:29:34 -0400
- From: Morten Welinder <mortenw@xxxxxxxxx>
- Subject: Re: Strict aliasing, yes or no?
You are making the situation sound a bit worse than it actually is.
> Not relying on aliasing forbids casting between dissimilar types, which
> rules out "normal" C tricks like casting between GArray and GRealArray
> (where GRealArray starts with the same members as GArray) as a way to have
> a partially-opaque struct, or an opaque-other-than-size struct on the stack;
> so regardless of whether it might be desirable to be writing Standard
> C, I'm not sure that GLib can do that without breaking its API.
C99 can do that, although access needs to be via a union type.
C99 section 184.108.40.206 #5. No API break would be need to do it.
> whether the usual C pseudo-object-orientation idiom (which
> is a fairly fundamental part of GObject) is considered to be valid in
> Standard C
That works fine. C99 section 220.127.116.11 #12.
glib (etc) _is_ stomping on the standard in a hundred different ways. Some
are for performance -- \0 filling, for example -- while others are pure laziness
and ignorance such as variables called "read" or macros name starting with "E".
gtk-devel-list mailing list