#### Automatic number to bool conversion in VFR

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,

Tomas Pilar (tpilar)

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?
Hi Konstantin,

I could be wrong, but this is my understading of the situation. The process of building and using HII includes transpiling a file written in VFR into IFR bytecode. This transpilation is custom for edk2 and therefore the transpiler is likely to be more 'quirky' than what you'd expect of your mainstream compiler. Especially for less-utilised syntax structures, where it had far less user testing. I've usually limited myself to well-worn paths when writing up a VFR file for a driver.

Cheers,
Tom

 1 - 2 of 2