static alignment and hash sync

Andrew Haley aph@cambridge.redhat.com
Fri Jun 8 09:19:00 GMT 2001


Tom Tromey writes:
 > >>>>> "Tony" == Tony Kimball <alk@pobox.com> writes:
 > 
 > Tony> Since you ask, I suppose I might try again, harder. I apologize,
 > Tony> but my current thinking is that my current trajectory (disabling hash
 > Tony> sync) is as likely to be productive (both for gcj and myself) as
 > Tony> backtracking to redo that step, so I will continue along it for a
 > Tony> while.
 > 
 > Whatever works for you is fine by me. You're doing the work...
 > I didn't know if you were aware of __attribute__((aligned)).
It's importsant to use __attribute__((aligned)) correctly on a type.
This program demonstrates the correct and incorrect use of aligned
better than I can explain.
#include <cstdio>
class a
{
 int b;
};
a __attribute__ ((aligned (8))) b;
a c __attribute__ ((aligned (8)));
class d : a {} __attribute__ ((aligned (8)));
int e __attribute__ ((aligned (8)));
typedef int my_int __attribute__ ((aligned (8)));
my_int g;
int main ()
{
 printf ("%d %d %d %d %d %d %d\n",
	 __alignof__ (a),
	 __alignof__ (b),
	 __alignof__ (c),
	 __alignof__ (d),
	 __alignof__ (e),
	 __alignof__ (my_int),
	 __alignof__ (g)
	 );
 return 0;
}
Andrew.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /