tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: style(5) proposal: forbid extern in .c
> > extern struct netif_stats le_stats[];
> >
> > static struct netif_dif le_ifs[] = {
> > /* dif_unit dif_nsel dif_stats dif_private */
> > { 0, NLE0CONF, &le_stats[0], le0conf, },
> > };
> > #define NLE_IFS (sizeof(le_ifs) / sizeof(le_ifs[0]))
> >
> > struct netif_stats le_stats[NLE_IFS];
riastradh@ wrote:
> 2. If le_stats is used only inside this file, replace `extern' by
> `static' and add `static' to the definition. No need for extern
> here. The forward declaration inside the .c file would still be
> allowed under this change.
mouse@ wrote:
> - If le_stats is - or might be, eg, depending on #defines - used from
> another file, the extern declaration should be moved into a .h used
> by both files.
>
> - If not, the extern should be converted to static and the later
> declaration should have static added to it.
Thanks, using 'static' as a forward declaration just works.
I'll commit the fix soon.
---
Izumi Tsutsui
Home |
Main Index |
Thread Index |
Old Index