Raised This Month: $ Target: $400
 0% 

Wierdness with arrays returning wrong value.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Trp. Jed
Member
Join Date: Aug 2004
Old 10-13-2004 , 18:36   Wierdness with arrays returning wrong value.
Reply With Quote #1

I've defined an array at the top of my code as follows:

Code:
new liveGrens[2] = {0, 0}

And, at the end of the plugin_init, just to be sure (because of this bug) i'm zero it again with:

Code:
liveGrens[0] = 0 liveGrens[1] = 0

Now I've gone through my code and the only operations I do on this array is adding or subtracting one from the value with, for example:

Code:
liveGrens[0] += 1 liveGrens[1] -= 1

Thing is, liveGrens[1] is fine and never has a problem but liveGrens[0] for some reason seems to hold some stupidly high number, for example 1147707392 even after its initialised and before anything is done with it.

I have gone over my code and checked theres no erronious assignment operators instead of comparison ones and it looks fine.

Anyone have any idea what it is?

I can probably code a work around but I'd rather not do it if its something simple to fix that I've overlooked.
Trp. Jed is offline
Da Bishop
Senior Member
Join Date: Aug 2004
Location: Chester County PA
Old 10-13-2004 , 21:26  
Reply With Quote #2

try this

Code:
new liveGrens[3] = {0, 0}

and use liveGrens 2 and 1
Da Bishop is offline
Send a message via MSN to Da Bishop
devicenull
Veteran Member
Join Date: Mar 2004
Location: CT
Old 10-13-2004 , 21:33  
Reply With Quote #3

Post complete code?
__________________
Various bits of semi-useful code in a bunch of languages: http://code.devicenull.org/
devicenull is offline
Da Bishop
Senior Member
Join Date: Aug 2004
Location: Chester County PA
Old 10-13-2004 , 21:38  
Reply With Quote #4

That was gonna be my next suggestion. Kinda hard to tell whats going on with just that. Possibly a loop of some kind.
Da Bishop is offline
Send a message via MSN to Da Bishop
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 10-14-2004 , 13:35  
Reply With Quote #5

Might be a bug in the compiler. Please post the whole code and the compiled file. Thanks.
__________________
hello, i am pm
PM is offline
Trp. Jed
Member
Join Date: Aug 2004
Old 10-14-2004 , 14:18  
Reply With Quote #6

OOh Lord, I coded a hack in to fix it now

I'll see if I can write something that replicates the error.
Trp. Jed is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:16.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode