[comp.lang.c] blobal data in C programming...

GROSSELL%UCHCECVM.BITNET@CUNYVM.CUNY.EDU (03/22/88)

Date: 21 March 1988, 20:00:53 HOC
From: GROSSELL at UCHCECVM
To:   INFO-C@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@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@cs.vu.nl>
>South-Africa:                    |Maarten Litmaath @ Free U Amsterdam:
>      revival of the Third Reich |maart@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@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

maart@cs.vu.nl (Maarten Litmaath) (03/23/88)

In article <12562@brl-adm.ARPA> GROSSELL%UCHCECVM.BITNET@CUNYVM.CUNY.EDU writes:
\...
\>From:         Maarten Litmaath <maart@cs.vu.nl>
\>South-Africa:                    |Maarten Litmaath @ Free U Amsterdam:
\>      revival of the Third Reich |maart@cs.vu.nl, mcvax!botter!ark!maart
\
\   Come on, let's not get political...
\...

Afraid or what?
-- 
South-Africa:                         |Maarten Litmaath @ Free U Amsterdam:
           revival of the Third Reich |maart@cs.vu.nl, mcvax!botter!ark!maart