🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
How to use not operator?
I'm having trouble using the logic 'not' operator. I tried looking up the docs and also had a quick look-around in the forum but I couldn't find any examples.
I'm basically writing code as in the following:
void myFunc()
{
bool b = false;
if (!b)
{
// do something here
}
}
The AS compiler fails on the (!) symbol saying that it is an unsupported operation for the datatype. I tried using "not" but to no avail. I am assuming here that (!) and (not) are equivalent tokens since (&&) and (||) and interchangable with (and) and (or) respectively.
Am I doing something wrong?
P.S. I'm using the stable version but I did not have the opportunity to try this out with an earlier stable or WIP version. Platform is Win32.
This bug was introduced when I added const for objects.
You can fix it by changing line 4537 in as_compiler.cpp, function CompileExpressionPreOp() to:
if( ctx->type.dataType.IsEqualExceptConst(asCDataType(ttBool, true, false)) )
instead of:
if( ctx->type.dataType == asCDataType(ttBool, true, false) )
Thanks for discovering this bug.
Regards,
Andreas
You can fix it by changing line 4537 in as_compiler.cpp, function CompileExpressionPreOp() to:
if( ctx->type.dataType.IsEqualExceptConst(asCDataType(ttBool, true, false)) )
instead of:
if( ctx->type.dataType == asCDataType(ttBool, true, false) )
Thanks for discovering this bug.
Regards,
Andreas
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement