Automatic number to bool conversion in VFR


Konstantin Aladyshev
 

Hello!

I was experimenting with conditions under the `suppressif` statement:
```
suppressif TRUE; - element is not present
suppressif FALSE; - element is present
```
From the C language I'm used to the fact that 0 is FALSE, and every
other number is TRUE. And at first glance it looks like VFR has the
same cast:
```
suppressif 2; - not present
suppressif 1; - not present
suppressif 0; - present
```
But when I've tried to create more complicated expressions I have
found out some strange things:
```
suppressif (1 AND 0); - present
suppressif (1 AND 1); - present (???)
suppressif (0 OR 0); - present
suppressif (1 OR 0); - present (???)
suppressif (TRUE OR 0); - present (???)
```
It looks like for correct behaviour explicit cast is needed:
```
suppressif ((BOOLEAN)1 AND (BOOLEAN)1); - not present
suppressif ((BOOLEAN)1 OR (BOOLEAN)0); - not present
suppressif (TRUE OR (BOOLEAN)0); - not present
```

Can someone explain to me the logic when the cast statement is not present?

Best regards,
Konstantin Aladyshev

Join discuss@edk2.groups.io to automatically receive all group messages.