From: Albert Cahalan <acahalan@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: anon unions are cool
Date: Sun, 22 Jan 2006 19:36:40 -0500 [thread overview]
Message-ID: <787b0d920601221636h7acbb891wd52b88e0aea75aaf@mail.gmail.com> (raw)
Now that the kernel requires a compiler that
supports anonymous unions, we can do some
really neat stuff.
For example, suppose we wanted to rename
a badly-named struct member. If the struct is
used all over the kernel, this becomes a giant
project with huge potential for patch conflicts.
Anonymous unions solve this. First, we replace
the badly-named struct member with an anonymous
union containing both the old name and the new
name. Second, we change much of the kernel
to use the new name. Third, we mark the old name
with the __depricated tag to generate warnings.
Fourth, we get the stragglers over days or months.
Fifth, we get rid of the anonymous union by replacing
it with the new name.
The struct evolves like so:
struct a {
int foo;
int bad;
int bar;
};
struct a {
int foo;
union {
int bad;
int baz;
};
int bar;
};
struct a {
int foo;
union {
int __deprecated bad;
int baz;
};
int bar;
};
struct a {
int foo;
int baz;
int bar;
};
next reply other threads:[~2006-01-23 0:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-23 0:36 Albert Cahalan [this message]
2006-01-23 0:56 ` Kyle Moffett
2006-01-23 1:17 ` Albert Cahalan
2006-01-23 18:25 ` Eric W. Biederman
2006-01-24 3:39 ` Albert Cahalan
2006-01-24 6:04 ` Kyle Moffett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=787b0d920601221636h7acbb891wd52b88e0aea75aaf@mail.gmail.com \
--to=acahalan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®