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 6.5.2.2 #5.  No API break would be need to do it.


whether the usual C pseudo-object-orientation idiom[1] (which
is a fairly fundamental part of GObject) is considered to be valid in
Standard C

That works fine.  C99 section 6.7.2.1 #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".

Morten


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]