TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
ASML C Coding Standard
Search

Rule:  6.4.2.dChecked automatically with code checker

Synopsis:Don't use extern variable declarations in header files, except for consts.
Language:C
Severity Level:6
Category:Lexical Elements


Description:

Justification

Functions should be used to control the access to variables and allow the implementation to use synchronization (for multi-threaded use). This holds especially for arrays, because the function call can provide destination-buffer size checking and protects the client from array size changes beyond what it is capable of handling.

Example

In header files:

/* WRONG */
extern error_desc_type error_table[];
extern choice_menu menu;
/* RIGHT */
const int i = 5;