www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/15/22:12:15

From: "William J. Urban II" <wjurban AT tca DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Global variables and structs?
Date: Tue, 15 Feb 2000 21:10:25 -0600
Organization: Posted via Supernews, http://www.supernews.com
Lines: 15
Message-ID: <sak249572pd170@corp.supernews.com>
X-Complaints-To: newsabuse AT supernews DOT com
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello all,
    Well I am in a C++ class and also teaching myself some simple 2d game
writing with allegro.  Now, in class we learned about Global variables and
how we should use them sparingly.  My question is why?  I have a small move
the sprite around the screen program and every time I call the function to
update the screen I have to pass about 8 parameters.  I am thinking of
rewriting this tonight with global variables so that I dont have to keep
passing every single parameter.  Any thoughts on this?  Now I can understand
if its a variable like x but when its something specific that I wont use as
another variable like mapLocX than I don't understand why I shouldn't make
it global.  Thanks in advance.

Will


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019