This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/26370] anon union/struct at top level
- From: "acahalan at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Feb 2006 23:20:21 -0000
- Subject: [Bug c/26370] anon union/struct at top level
- References: <bug-26370-12219@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from acahalan at gmail dot com 2006-02-19 23:20 -------
Here is an example of something that is seriously awkward to do in C.
Suppose I want to ensure that several variables end up in the same cache line.
I'd like to do it this way:
struct {
short s1;
short s2;
unsigned offset;
long long ll;
}__attribute__ ((aligned(32)));
Without anon union support, I have to come up with a useless name. For exactly
the same reasons why people like anon structs within structs, I want an struct
here. It's just plain ugly to prefix every variable usage withsome garbage like
"u42.".
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26370