Bug? (Arrays of length 1)
Displaying 1-5 of 5 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
torin

Arrays of length 1 don't seem to work properly. e.g.:


int test[1];
void autoexec() {
test[0] = 42;
}


This gives me an 'Unknown variable assignment operator: '['' error on the line 'test[0] = 42', as though VERGE doesn't consider 'test' an array (just because it's short - how cruel!).

Any plans to fix this?

Posted on 2005-07-03 13:02:24

Omni

Er, maybe it just doesn't consider it an array.

Does it matter? You're not going to be able to change the array size or anything, so why not just use a normal variable assignment?

[...although I would expect any variable assigned as an array to be accessible as an array, so this should probably be addressed...]

Posted on 2005-07-03 13:24:27

torin

Well, it matters to me a bit, because I'm writing a tool to generate VC code automatically. I could have a special case ('if this array would have size 1, make it a variable instead'), but then I'd have to change all the code that accesses the array too and it would be a bit of a mess.

I can think of other situations where this might come up. Suppose someone made a library that created an array of large data structures, and had the client #define a constant that set the size of the array before #including the library. The way arrays work now, they could not set the array size to 1, even if they only needed one of the large data structures.

So while arrays of size 1 might be a bit unusal, I think it's better if they behave the same as other arrays regardless.

Posted on 2005-07-03 14:26:41

mcgrue

Added as a bug.

Posted on 2005-07-03 15:16:11

Jesse

I believe I have fixed this problem.

Posted on 2005-07-04 21:33:25


Displaying 1-5 of 5 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.