Inverting a bool inconsistent using NOT (Flowcode 7)

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
licensing
Posts: 2
http://meble-kuchenne.info.pl
Joined: Tue Nov 01, 2022 8:59 am

Inverting a bool inconsistent using NOT (Flowcode 7)

Post by licensing »

If a boolean variable e.g. LtoR is inverted using NOT function
e.g. LtoR = NOT(LtoR)
then it works in a simulated decision but the generated code
uses bitwise inversion (~) and the resulting value is not equivalent
to false.
CODE GENERATED:
// Flip direction
// Calculation:
// LtoR = NOT (LtoR)
FCV_LTOR = ~(FCV_LTOR)

licensing
Posts: 2
Joined: Tue Nov 01, 2022 8:59 am

Re: Inverting a bool inconsistent using NOT (Flowcode 7)

Post by licensing »

LtoR = !(LtoR) works correctly in simulation and generated code.

chipfryer27
Valued Contributor
Posts: 1149
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 285 times
Been thanked: 412 times

Re: Inverting a bool inconsistent using NOT (Flowcode 7)

Post by chipfryer27 »

Hi

If you do a search for difference between NOT and ! you should get the answer.

This link gives a guide

https://www.tutorialspoint.com/cprogram ... rators.htm

Regards

PS
If you are using Flowcode V7 then please post in that forum.

Post Reply