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
On Wed, 15 Mar 2023, Taylor R Campbell wrote:
Proposal: Forbid extern declarations in .c files.
extern declarations in .c files invite easily avoided bugs where the
definition and use have mismatched types, because the compiler doesn't
have an opportunity to check them. Fix: Always put the extern
declaration in a .h file shared by the .c file defining it and the .c
files using it.
Pretty simple. Any objections?
Long overdue IMHO.
Go for it.
+--------------------+--------------------------+----------------------+
| Paul Goyette | PGP Key fingerprint: | E-mail addresses: |
| (Retired) | FA29 0E3B 35AF E8AE 6651 | paul%whooppee.com@localhost |
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoyette%netbsd.org@localhost |
| & Network Engineer | | pgoyette99%gmail.com@localhost |
+--------------------+--------------------------+----------------------+
Home |
Main Index |
Thread Index |
Old Index