From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Problems with variables Date: Fri, 08 May 1998 20:01:38 -0400 Organization: Two pounds of chaos and a pinch of salt. Lines: 43 Message-ID: <35539CE2.7F0F@cs.com> References: <3553258D DOT 5C54 AT bergen DOT mail DOT telia DOT com> NNTP-Posting-Host: ppp121.cs.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk John Kismul wrote: > > Hi > > I've got a problem with using variables in my programs. > Sometimes when I try to access a variable, my program will access > another variable instead. > > char A > char B > > A = 45; This will set both A and B to 45. > > It doesn't happen with every variable I use, only some of them. > The compiler I'm using is PGCC 1.0.1 Please post some actual sample code that demonstrates this problem. Most of the cases of variables overwriting each other I can think of in actual programming deal with pointers, out-of-bounds array accesses, stack overflows, invalid typecasts ( (int) A = 45, for example ), or calls to scanf() that use incorrect format specifiers. In C++, I might add that reference-type variables can overwrite each other, but that's why they're there in the first place. The only way we could tell would be to have some sample code we could test ourselves. One other possibility could be bugs in PGCC which are not within the scope of the DJGPP discussion group. PGCC is an independently-supported project and there is a mailing list, AFAIK, which should be listed in the documentation. If you think your problem may have something to do with PGCC, try looking on their list of known bugs and if you don't see anything, submit your own query or bug report. hth! -- John M. Aldrich, aka Fighteer I UIN# 7406319 -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS d- s+:- a-->? C++>$ U@>++$ p>+ L>++ E>++ W++ N++ o+>++ K? w(---) O- M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+(++) tv+() b+++ DI++ D++ G>++ e(*)>++++ h!() !r !y+() ------END GEEK CODE BLOCK------