Re: creating a character driver

From: Jamie Lokier (lk@tantalophile.demon.co.uk)
Date: Tue Mar 07 2000 - 18:27:10 EST


Richard B. Johnson wrote:
> NULL, }; /*release*/
> ^_______ Right here.
>
> Trailing commas are allowed, but not good coding style. I suggest you
> fill in all the blanks. There was a recent change in the kernel (six
> months ago), that changed the size of this structure. The hack to
> get around this, until the size stabilizes, is the trailing comma.

The was an even more recent change in the kernel that changed all the
operations structures to use labelled initialisers. The new recommended
syntax is this:

static struct file_operations th_fops = {
       write: th_write,
};

Trailing commas are used extensively in the kernel, to avoid typos when
cutting and pasting or when using #ifdef. E.g. take a look at mem.c and
lp.c.

have a nice day,
-- Jamie

-
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/



This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 21:00:24 EST