Messages in this thread | | | Subject | Re: URL to the latest /proc/driver/microcode | From | Peter Samuelson <> | Date | 17 Feb 2000 22:41:22 -0600 |
| |
[Bill Wendling <wendling@ganymede.isdn.uiuc.edu>] > +static struct file_operations microcode_fops = { > + write: microcode_write, > + open: microcode_open, > + release: microcode_release, > +}; > > I'm guessing the above is a gcc extension to C of initializing a few > members of a structure? It's slightly confusing, but a stylistic choice. > (If it's standard C, I've never come across it before).
Right, it's a gcc extension. (ISO rather recently came up with different syntax -- which I can't remember exactly except that IMHO it's ugly -- to do the same thing. They couldn't just use gcc syntax, could they? Nooooo....) I guess it kind of goes without saying that the missing fields always get nulls.
The advantages of initializing structures this way are obvious: increased source compatibility when fields are added/removed/moved, and readability (no need for a comment for each member).
Peter
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |