[comp.sys.amiga.tech] bug in Manx C

sjk@utastro.UUCP (Scot Kleinman) (09/15/88)

	I think I have a uncovered a bug in my version of Aztec C 3.60a.
I'm in  a function, have just set a variable I am going to return, but am 
entering a for loop that modifies some other variables.  At the end of the
for loop, my original variable (the one I first set and am going to return)
has been changed.  I put a printf in the loop and found that the change occurs
only on the last loop iteration.  I would include the code, but I thought I 
heard that there is a 3.60b version out.  I have not heard about this from
Manx, but if it is indeed out, maybe they already cured the bug.  If this
release is not out, I can post my code (it is short) and would like to know
if others have had similar problems and/or have reported it to Manx Techs.
If it is out, let me know, too, so I can contact Manx for the upgrade.

Thanks much

Scot   sjk@astro.as.utexas.edu
Aren't we all having fun?

jones@ingr.UUCP (Mark Jones) (09/16/88)

In article <3111@utastro.UUCP>, sjk@utastro.UUCP (Scot Kleinman) writes:
> 
> 	I think I have a uncovered a bug in my version of Aztec C 3.60a.
> I'm in  a function, have just set a variable I am going to return, but am 
> entering a for loop that modifies some other variables.  At the end of the
> for loop, my original variable (the one I first set and am going to return)
> has been changed.  I put a printf in the loop and found that the change occurs
> only on the last loop iteration.  I would include the code, 

Please include the code, this sounds a lot like a subscript out of range
problem. 

sjk@utastro.UUCP (Scot Kleinman) (09/19/88)

	Dear Net,     
A while ago I posted a problem I had in Manx with a variable being changed after
running a loop which modified other variables.  Well, it turns out, I was indeed
overwriting an array.  Chalk it up to being a novice programmer, not used to the
intricasies of C.  I am now a little confused, however.  The first element in an
array is numbered 0 (i was using a char array in my procedure), so when you
declare the array, does one declare the number of entries (ex.3 entries numbered
0, 1, and 2) or the highest index number (ex. 3, giving 4 entries 0,1,2,3)? I 
assume, from my mistake, that the former is the proper technique, but trying to
test the theory confused me even more.
I guess I sould really be posting this to the C net, but I wanted to explain
what had happened, and apologize for suggesting it may be a bug (oh, what 
ignorance!)
The program I am working on is designed to be run on startup and will tell
the uer whose birthdays are coming up within the next two weeks.  I can post
it when (and if) I ever figure it all out.  Thanks for being patient with me
and for helping me out.

Scot   sjk@astro.as.utexas.edu
Thanks a million! -Phil Alvin