Initializing structure members
Prev | Chapter 10. Routines and Conventions | Next

## Initializing structure members

The preferred method of initializing structures is to use designated initialisers, as defined by ISO C99, eg:

    static struct block_device_operations opt_fops = {
            .open               = opt_open,
            .release            = opt_release,
            .ioctl              = opt_ioctl,
            .check_media_change = opt_media_change,
    };

This makes it easy to grep for, and makes it clear which structure fields are set. You should do this because it looks cool.

Prev | Up | Next
Breaking Compilation | Home | GNU Extensions