www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000261

When Created: 12/04/1998 21:00:02
Against DJGPP version: 2.01
By whom: dead-iguana@juno.com
Abstract: Failure of variables to retain value.
In several projects I have been working on lately, I have noticed something
occurring which I believe to be a bug in the compiler.   I have noticed
this bug in both 2.00 and 2.01.

After assigning a value to a variable in one function, the value does
not remain the same in the next function that uses this variable.  In
my most recent encounter with this bug, I was coding in C++ with some
simple classes.  I have a public non-static int variable in a simple
class with no inheritence or anything special, and in this class's
constructor, I set this variable's value to 0 (zero).  Later, a 
different function receives an object (of same class that I was working
on) via a pointer, and I check the variable's value like so:

if(object->var == 0)

and the variable does not equal 0 (zero).  The variable is not modified
or even examined in between the constructor and the function that examins
the variable of which I just described.    The object, of course, had
been created in another function(it was a pointer '*'), and was passed as a 
pointer ('*') as I just mentioned.


I have also encountered this before while I was working in C with 
struct's in a similar situation.

Has anyone else had this happen to them, and if this is a bug, will
it be fixed?  It is quite annoying and a real pain to work around.

Note added: 12/08/1998 15:00:14
By whom: dead-iguana@juno.com
Sorry everyone for posting this.  This is not a bug but is simply a 
problem I had in my program.  Again, this is my fault, and sorry for
posting this here.   If anybody knows how, feel free to delete this.

Thank you.

Closed on 12/14/1998 12:00:37: Non-bug: Mistake was in the test case
By whom: broeker@physik.rwth-aachen.de



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