Path: utzoo!mnetor!uunet!husc6!yale!cmcl2!brl-adm!adm!GROSSELL%UCHCECVM.BITNET@CUNYVM.CUNY.EDU From: GROSSELL%UCHCECVM.BITNET@CUNYVM.CUNY.EDU Newsgroups: comp.lang.c Subject: Re: blobal data in C programming... Message-ID: <12562@brl-adm.ARPA> Date: 22 Mar 88 04:27:51 GMT Sender: news@brl-adm.ARPA Lines: 48 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 TYPE_aa aa; bb.c /* Here we need to reference 'aa'. (It should not be needed if our program is well structured.)*/ #include extern TYPE_aa aa; >From: Doug Gwyn >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 >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