Use struct to increase modularity

struct usage is a good way to avoid global namespace pollution and to decrease the probability of global names clashes.

For example, one can group related data into a global struct, so only one name is visible at global level. For example:

/* global data */
int a,b ;
long c ;
char t[10] ;
could be replaced by an (anomymous or not) struct
struct
{
  int a,b ;
  long c ;
  char t[10] ;
} mycontext ;

Data should be addressed by expressions such as mycontext.c = 23 ; wich is verbose but has exactly the same cost as c = 23 ;



Alain Gibaud 2015-07-09