Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!adm!hamilton@nmsu.csnet From: hamilton@nmsu.csnet Newsgroups: comp.lang.pascal Subject: Re: Global variables Message-ID: <12654@brl-adm.ARPA> Date: 26 Mar 88 13:32:51 GMT Sender: news@brl-adm.ARPA Lines: 44 From info-pascal-request%brl-vim.arpa%csnet-relay Thu Mar 24 20:26:00 1988 Received: from sparta by zia (3.2/NMSU) id AA26785; Thu, 24 Mar 88 20:25:58 MST Received: from chaco by sparta (3.2/) id AA11749; Thu, 24 Mar 88 20:25:47 MST Received: by chaco (3.2/NMSU) id AA21473; Thu, 24 Mar 88 19:51:02 MST Received: from relay.cs.net by RELAY.CS.NET id ai20109; 24 Mar 88 15:31 EST Received: from brl-vim.arpa by RELAY.CS.NET id aa27978; 24 Mar 88 15:30 EST Received: from BRL-VIM.ARPA by VIM.brl.ARPA id aa02947; 24 Mar 88 14:15 EST Received: from brl-adm.arpa by VIM.BRL.ARPA id aa02798; 24 Mar 88 14:04 EST Received: from USENET by ADM.BRL.ARPA id aa19178; 24 Mar 88 13:50 EST From: "John L. Cusack" Newsgroups: comp.lang.pascal Subject: Global variables Message-Id: Date: 24 Mar 88 16:16:49 GMT To: info-pascal%brl-vim.arpa Received: from CSNet-Relay by nmsu; 24 Mar 88 19:10:36-MST (Thu) Status: RO What is the big deal about not declaring your variables global? At Carnegie Mellon this is a big deal, but I see that Borland and other programmers have developed their programs using global variables. Is it just the different approach or is Carnegie Mellon trying to prove something by not using global variables? What is so wrong with using global variables? John Cusack Carnegie Mellon '91 The idea of not using global variables in subprograms (user built functions and procedures) is to make them self-contained. This means that subprograms will be immune to any ill-conceived changes to the main program's global variables. This technique also enhances the idea of re-usable code. The ideas expressed above are my own, and my organization may or may not agree. Herb Hamilton