Forum

Very Easy FTEQCC Compile Question

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Very Easy FTEQCC Compile Question

Postby Baker » Mon Oct 13, 2008 8:27 am

Why doesn't FTEQCC like this?

bprint(")");


I get "error: expected ;, found )"

Not a "problem", I just add a space and make it bprint(") "); and the issue goes away, but I'd just like to know why the compiler doesn't like the original above.
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Wazat » Mon Oct 13, 2008 8:54 am

Weird! Maybe try:

Code: Select all
bprint("\)");
or
bprint(")\
");


... and see what that does.

Must be a mistake in the compiler. I would almost expect it to actually be an error in another line (like a " that isn't paired), but since adding a space after the ) fixes it then I doubt that's the case.

Maybe check the fteqcc readme. A ) may be a special character in double-quote strings that's being interpreted to have a special meaning or reference rather than taken literally. Maybe it's expecting a parameter (like a printf with a %i in it) or something after the "" string ends, or the ) is acting like a \ on the ending ", so the string isn't getting terminated or is otherwise weirding out.
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Wazat
 
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Postby Spike » Mon Oct 13, 2008 9:02 am

Strange...
) isn't a special character at all for strings (other than that it'll terminate a #MACRO name inside a string).

I'll need to look into this some time...

Everything else compiles and runs fine, I assume, just with the extra space?
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Baker » Mon Oct 13, 2008 9:11 am

Spike wrote:Strange...
) isn't a special character at all for strings (other than that it'll terminate a #MACRO name inside a string).

I'll need to look into this some time...

Everything else compiles and runs fine, I assume, just with the extra space?


Yeah, everything else compiles fine and it runs fine if I add the extra space.

I may not be using the current build of FTEQCC, I will download current version, test again and see what happens sometime later today.

I am playing around with Paraboil Frogbot stuff and it has numerous #IFDEFs in it, btw, so it could have something to do with that.
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby FrikaC » Mon Oct 13, 2008 5:11 pm

I solved this bug before in FrikQCC, it's a QCC bug iirc, and the cause is that ")" passes the PR_Check for the end of the function call regardless of the fact it is flagged as a string token type and not a punctuation token type. There's a bunch of ways to solve it. I forgot which one I chose.
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby Spike » Mon Oct 13, 2008 10:24 pm

Yup FrikaC is quite correct with that solution. Thanks, you just made my life that little bit easier.
In the mean time, just make a global string closebracket=")"; :D

I'd commit it but I'm lazy, and have a few other tweeks in there which will cause all sorts of similar obscure errors.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Baker » Wed Oct 15, 2008 3:26 am

Spike wrote:Yup FrikaC is quite correct with that solution. Thanks, you just made my life that little bit easier.
In the mean time, just make a global string closebracket=")"; :D

I'd commit it but I'm lazy, and have a few other tweeks in there which will cause all sorts of similar obscure errors.


I wasn't using the current version of fteqcc and this problem doesn't occur in the current version of fteqcc.

So I guess that's that.
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Spike » Wed Oct 15, 2008 10:42 am

Hrm? that problem should appear in the current svn version.
And if it doesn't then I don't know why it works. :)

I'll commit a fix once I properly get around to testing variable initialisers on locals... and support for #if defined(a) || defined(b)... and figure out what LH wants to do with a possible -TDP option.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest