[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dumb compilation question
On Sun, 4 Mar 2001, Peter Jay Salzman wrote:
> omigosh. i only spent a /couple of hours/ staring at this. i told you it was
> a dumb compilation question! hee hee. :)
Oh, it's happened to me before as well, plenty of times ;)
<snip/>
>
> also, yesterday, i noticed that "real" drivers use a syntax to fill a fops
> structure. was shocked to see it because i never saw this syntax before,
> but it's pretty cool. must be a gcc extension:
>
> static struct file_operations fops = {
> read: &device_read,
> write: &device_write,
> open: &device_open,
> release: &device_release
> };
>
> this is cool beyond belief. but the C99 way of doing things seems to work
> on gcc 2.95.3:
>
> static struct file_operations fops = {
> .read = &device_read,
> .write = &device_write,
> .open = &device_open,
> .release = &device_release
> };
>
> is it OK to use these C99'isms? i'm only asking because people who wrote
> the bleeding edge drivers, like daryll strauss's tdfx DRI module, use the
> gcc extension rather than C99. is it possible there's a reason for their
> choice, or is it a matter of style?
I only noticed this myself recently as well. The gcc manual suggests the
first method is obsolete since gcc 2.5[1]. Pity, I like it myself, but the
second way does seem to be more intuitive..
Good Luck,
Mark
[1] - http://gcc.gnu.org/onlinedocs/gcc_5.html#SEC91
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/
IRC Channel: irc.openprojects.net / #kernelnewbies
Web Page: http://www.surriel.com/kernelnewbies.shtml