[Bug manual/315] documentation correction for obstack alignment

eggert at gnu dot org sourceware-bugzilla@sources.redhat.com
Wed Aug 11 23:35:00 GMT 2004


------- Additional Comments From eggert at gnu dot org  2004-08-11 23:35 -------
DEFAULT_ALIGNMENT is the alignment of double only because of a
historical accident: when that code was originally written, the
alignment of double was the strictest for each host.  The intent was
that the default alignment would suffice, and that you can specify
a stricter alignment if you know what it is.

Typical obstack usage (e.g., the GCC source code, the Bison source
code) looks like this:

#if !defined(__GNUC__) || (__GNUC__ < 2)
#define __alignof__(type) 0
#endif
	      obstack_specify_allocation (&bitmap_obstack, OBSTACK_CHUNK_SIZE,
					  __alignof__ (bitmap_element),
					  obstack_chunk_alloc,
					  obstack_chunk_free);


and hence if GCC and/or Bison is compiled by a non-GCC compiler, the
obstack code will use the default alignment.  This typical usage works
in general only if the default alignment suffices for all types.

Also please see Bugzilla Bug 321
<http://sources.redhat.com/bugzilla/show_bug.cgi?id=321>;
once that patch is installed the alignment will no longer
necessarily be that of "double".


-- 


http://sources.redhat.com/bugzilla/show_bug.cgi?id=315

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the Glibc-bugs mailing list