Alignment of GTypeClass
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list gnome org
- Subject: Alignment of GTypeClass
- Date: 09 May 2001 13:02:53 -0400
We currently have:
struct _GTypeClass {
GType g_type;
};
Which has an alignment the same as GType - typically 4 bytes on 64 bit machines.
However, class structures deriving from GTypeClass typically contain
pointers, so have larger alignments - typically 8 on 64 bit machines.
So, GCC, with -Wcast-align produces warnings for things like:
(GObjectClass *) g_type_check_class_cast ((GTypeClass *)klass, G_TYPE_OBJECT);
Because the alignment of GTypeClass is being increased.
So, I think we need to change our definition of GTypeClass to:
struct _GTypeClass {
GType g_type;
}
#ifdef __GNUC__
__attribute__ ((aligned (G_MEM_ALIGN)))
#endif
;
Make sense?
Owen
[ P.S. The exact same problem occurs with GtkTypeClass and GTK+-1.2 ]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]