blobal data in C programming...
GROSSELL%UCHCECVM.BITNET at CUNYVM.CUNY.EDU
GROSSELL%UCHCECVM.BITNET at CUNYVM.CUNY.EDU
Tue Mar 22 14:27:51 AEST 1988
Date: 21 March 1988, 20:00:53 HOC
From: GROSSELL at UCHCECVM
To: INFO-C at BRL.ARPA at ARPA
I've been programing in C since 1984. This is the way I do it:
aa.h:
/* Here are all my defines and typedef's. (I do not
allocate any space for variables here.)*/
#define .....
typedef struct {.....} TYPE_aa; /* Or whatever... */
aa.c:
/* Here we allocate space for 'aa'. 'aa' is defined here
because is part of the aa data structure.*/
#include <aa.h>
TYPE_aa aa;
bb.c
/* Here we need to reference 'aa'. (It should not be
needed if our program is well structured.)*/
#include <aa.h>
extern TYPE_aa aa;
>From: Doug Gwyn <gwyn at brl-smoke.arpa>
>Source code that has a large number of global data pooled like this
>is woefully out of control. The proper place for defining a global
>datum (of which there should not be many!) is in the module that
>controls its meaning. If there isn't any such module, chances are
>that the design is quite poor.
That's a nice statement. I agree with it. Keep your data structures
ordered and everything will come easy.
>From: Maarten Litmaath <maart at cs.vu.nl>
>South-Africa: |Maarten Litmaath @ Free U Amsterdam:
> revival of the Third Reich |maart at cs.vu.nl, mcvax!botter!ark!maart
Come on, let's not get political...
Gonzalo Rossello
Systems Programmer, Centro de Computacion
Facultad de Ciencias Fisicas y Matematicas - Universidad de Chile.
Bitnet Address: GROSSELL at UCHCECVM
"English is my second language, and I've never been to an English
speaking country." Me
"Disclaimer: These are my views, not my employer" Some Body
More information about the Comp.lang.c
mailing list