V3 VergeC - Serious problems
Displaying 1-20 of 23 total.
12
next
geronimo
|
i don't see anything about it immediately, so here i gripe...
firstly, it'd be helpful if you got the correct line number back on a compile error (i never do)...
secondly, there are serious problems with true/false expressions..
while(
(stack[a]==stack[a-6])
|| ((stack[a]==stack[a-1]) && (stack[a]==stack[a-2]))
) {}
this particular example causes "expected ) but found = instead." most of the time i get "could not resolve identifier..!"
it's maddening...
in some cases i can solve it by using !(a^b) in place of (a==b)... in alot of cases i have to have big chunks of code repeating twice or more because i can't put it under one condition and i have to separate it into two or more ifs......
This seems really, really important to me. When is it gonna be fixed?
Posted on 2004-04-10 12:34:29
|
geronimo
|
sorry, but if you can't see the rest of the sentence the weird error message i get all the time is "could not resolve identifier..!"
Posted on 2004-04-10 12:36:04
|
anonymous
|
getting the wrong line from the compiler can be frustrating, but you can certainly work around it. It will tell you the general vicinity (give or take up to 30 lines), then you comment out sections of code until the error goes away. Reduce the amount of commented code till you find the problem line.
Posted on 2004-04-10 13:07:07
|
Omni
|
Back in Verge2 VC, I didn't think you could do multi-conditional while loops. It may not be available in Verge3 VC, either.
Use one condition in a while loop, and then nest your while loop code in a bunch of if statements.
While (general condition)
if (condition, condition, condition)
do loop code
Also, the compiler giving the wrong line on error return has been addressed in the V3 issues Sticky post--it has something to do with the compiler reading the next token before processing the current one or something. Anyway, Vecna says it's not a high priority since it's not really a game-breaker. Just be a little vigilant in trying to find the right line.
Posted on 2004-04-10 14:53:41 (last edited on 2004-04-10 14:56:12)
|
zonker6666
|
The simplest way to find where the error is really occurring is by looking at the vcc_verbose.txt file that gets created when you run verge. Scroll to the very end of the file ---- whatever function it was compiling when the error occurred will be listed there .. voila!
hope that helps
Posted on 2004-04-10 19:41:54
|
ThinIce
|
sorry... but why doesn't this work:
while(stack[a] == stack[a-6] && stack[a] == [stack[a-2] || stack[a] == stack[a-1])
{
blah();
}
Posted on 2004-04-10 19:47:01
|
ThinIce
|
Yay me, I broke extroversy again! (this is soon to be fixed btw)
Posted on 2004-04-10 19:48:28
|
Omni
|
Why don't you use:
int loop
loop = 1
while loop
{
if stack[a] == stack[a-6] && stack[a] == [stack[a-2] || stack[a] == stack[a-1])
{
blah()
}
else { loop = 0 }
Posted on 2004-04-10 20:25:24
|
geronimo
|
if( (Stack[a]==Stack[a-6]) || ((Stack[a-1]==Stack[a-2]) && (Stack[a]==Stack[a-1])) )
is another good example for the "Expecting ) but got = instead" category.
Posted on 2004-04-10 22:14:13 (last edited on 2004-04-10 22:21:03)
|
geronimo
|
i'm sorry i didn't clarify, but it's not while loops or even conditional branches at all that are the problem. here's another:
Stack[a]=( (Stack[a]>5) | Stack[a-6] );
"Expected ) but got > instead."
Posted on 2004-04-10 22:21:16 (last edited on 2004-04-10 22:56:11)
|
geronimo
|
if( (CurTimer>10) || (!CurTimer) ) {}
Causes an unknown keyword error waaay down below.
Posted on 2004-04-10 22:27:11
|
Overkill
|
Stack[a]=( (Stack[a]>5) | Stack[a-6] );
Is the Stack[a]>5 supposed to be a shift left? Because shift left is << not >.
Edit: Also, missing bracket:
Stack[a]=( (Stack[a]>5) | Stack[a-6] ) );
Posted on 2004-04-11 00:03:19 (last edited on 2004-04-11 00:10:25)
|
geronimo
|
it's supposed to be greater than. and there's no missing bracket, look closer....
Posted on 2004-04-11 00:18:03
|
geronimo
|
aen suggested evaluating the individual conditions first and storing them in vars, to keep the expressions simple.
t1=(CurTimer>10);
t2=(!CurTimer);
if(t1 || t2)
{
...
"Expected ) but got > instead."
Posted on 2004-04-11 00:29:16
|
Overkill
|
OK, how about:
if( (10-curtimer) || !curtimer)
{
//...
}
EDIT: Hell, if that doesn't work, why don't you have two sperate "if"s or "while"s or whatever, and have the same code for each?
Posted on 2004-04-11 00:35:07 (last edited on 2004-04-11 00:42:00)
|
geronimo
|
Overkill: i've been finding out how complicated that can make things
Posted on 2004-04-11 00:41:49
|
Overkill
|
Yes, it is complicating things...
I don't get why your code will error, because I have codes that have multiple statements (not that bracketed however) and they work fine.
Posted on 2004-04-11 00:45:10
|
aen
|
I've had no direct hand in V3's compiler, but some words of warning:
There are problems in many situations with nesting parens or brackets. Here, you can achieve what you're wanting with something along these lines:
int b;
...
if (stack[a]==stack[a-1] && stack[a]==stack[a-2]) b=1; else b=0;
while (stack[a] == stack[a-6] || b) {
// do stuff
if (stack[a]==stack[a-1] && stack[a]==stack[a-2]) b=1; else b=0;
}
Stuff the result in a temp var, and recalculate that within the loop. I wouldn't put much stock in trying direct assignments with conditionals ala:
b = (stack[a]==stack[a-1] && stack[a]==stack[a-2]);
Keep conditionals in if/while statements, and expressions in assignments.
Posted on 2004-04-11 01:06:47
|
aen
|
The nested parens problem surfaces here as well:
if ((CurTimer>10) || (!CurTimer)) {}
The following will compile without complaint, however:
if (CurTimer>10 || !CurTimer) {}
Posted on 2004-04-11 01:09:26 (last edited on 2004-04-11 01:10:17)
|
Omni
|
aen suggested evaluating the individual conditions first and storing them in vars, to keep the expressions simple.
t1=(CurTimer>10);
t2=(!CurTimer);
if(t1 || t2)
{
...
"Expected ) but got > instead."
If that doesn't work...maybe it's because V3 only interprets conditionals in the scope of an If or While conditional. Maybe it doesn't really expect you to use a conditional as an assignment or as an expression at all outside of a where a conditional is needed.
Perhaps it's something wrong with the CurTimer variable itself? From a programming standpoint, there's nothing syntactically wrong with your code. But V3 is interpreted, so maybe it's something wrong on the V3-side.
Posted on 2004-04-11 03:55:00
|