Commit 01107300 authored by Sam Ravnborg's avatar Sam Ravnborg

[PATCH] kerneldoc: In kernel-hacking describe designated initialisers

Designated initialisers as per ISO C99
parent 6f834a78
...@@ -1085,18 +1085,17 @@ EXPORT_NO_SYMBOLS; ...@@ -1085,18 +1085,17 @@ EXPORT_NO_SYMBOLS;
<title>Initializing structure members</title> <title>Initializing structure members</title>
<para> <para>
The preferred method of initializing structures is to use the The preferred method of initializing structures is to use
gcc Labeled Elements extension, eg: designated initialisers, as defined by ISO C99, eg:
</para> </para>
<programlisting> <programlisting>
static struct block_device_operations opt_fops = { static struct block_device_operations opt_fops = {
open: opt_open, .open = opt_open,
release: opt_release, .release = opt_release,
ioctl: opt_ioctl, .ioctl = opt_ioctl,
check_media_change: opt_media_change, .check_media_change = opt_media_change,
}; };
</programlisting> </programlisting>
<para> <para>
This makes it easy to grep for, and makes it clear which This makes it easy to grep for, and makes it clear which
structure fields are set. You should do this because it looks structure fields are set. You should do this because it looks
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment