Discussion:
[edk2] "cond" vs. ?
Tim Lewis
2015-06-10 02:48:24 UTC
Permalink
Folks -

It appears that the VFR spec is not clear about how the 2nd and 3rd parameters of the "cond" operator are handled.

cond(expr1, expr2, expr3)

Is it: if (expr1) then x = expr2 else expr3

Or

If (expr1) then x = expr3 else expr2

We have seen alternate implementations in the wild.

Thanks,

Tim

The VFR spec says:


conditionalExp ::=

"cond"

"("

vfrStatementExpression

"?"

vfrStatementExpression

":"

vfrStatementExpression

")"

BEHAVIORS AND RESTRICTIONS:

Generates EFI_IFR_CONDITIONAL op-codes.VFR Description in BNF 52

Example:

numeric varid = MyData.Data,

prompt = STRING_TOKEN(STR_PROMPT),

help = STRING_TOKEN(STR_HELP),

minimum = 0,

maximum = 255,

default value = cond(2 == 1 ? 5 : 10),
endnumeric;
Gao, Liming
2015-06-10 09:00:41 UTC
Permalink
Lewis:
Second way. If (expr1) then x = expr3 else expr2

Thanks
Liming
From: Tim Lewis [mailto:***@insyde.com]
Sent: Wednesday, June 10, 2015 10:48 AM
To: edk2-***@lists.sourceforge.net
Cc: Lawrence Chiu
Subject: [edk2] "cond" vs. ?

Folks -

It appears that the VFR spec is not clear about how the 2nd and 3rd parameters of the "cond" operator are handled.

cond(expr1, expr2, expr3)

Is it: if (expr1) then x = expr2 else expr3

Or

If (expr1) then x = expr3 else expr2

We have seen alternate implementations in the wild.

Thanks,

Tim

The VFR spec says:


conditionalExp ::=

"cond"

"("

vfrStatementExpression

"?"

vfrStatementExpression

":"

vfrStatementExpression

")"

BEHAVIORS AND RESTRICTIONS:

Generates EFI_IFR_CONDITIONAL op-codes.VFR Description in BNF 52

Example:

numeric varid = MyData.Data,

prompt = STRING_TOKEN(STR_PROMPT),

help = STRING_TOKEN(STR_HELP),

minimum = 0,

maximum = 255,

default value = cond(2 == 1 ? 5 : 10),
endnumeric;
Tim Lewis
2015-06-10 09:11:25 UTC
Permalink
Yes. But this is confusing because the VFR specification is not clear. As a result, many programmers assume that the cond() operator will work like the C ? operator.

How do we get the VFR specification updated?

Thanks,

Tim

From: Gao, Liming [mailto:***@intel.com]
Sent: Wednesday, June 10, 2015 5:01 PM
To: edk2-***@lists.sourceforge.net
Cc: Lawrence Chiu
Subject: Re: [edk2] "cond" vs. ?

Lewis:
Second way. If (expr1) then x = expr3 else expr2

Thanks
Liming
From: Tim Lewis [mailto:***@insyde.com]
Sent: Wednesday, June 10, 2015 10:48 AM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Cc: Lawrence Chiu
Subject: [edk2] "cond" vs. ?

Folks -

It appears that the VFR spec is not clear about how the 2nd and 3rd parameters of the "cond" operator are handled.

cond(expr1, expr2, expr3)

Is it: if (expr1) then x = expr2 else expr3

Or

If (expr1) then x = expr3 else expr2

We have seen alternate implementations in the wild.

Thanks,

Tim

The VFR spec says:


conditionalExp ::=

"cond"

"("

vfrStatementExpression

"?"

vfrStatementExpression

":"

vfrStatementExpression

")"

BEHAVIORS AND RESTRICTIONS:

Generates EFI_IFR_CONDITIONAL op-codes.VFR Description in BNF 52

Example:

numeric varid = MyData.Data,

prompt = STRING_TOKEN(STR_PROMPT),

help = STRING_TOKEN(STR_HELP),

minimum = 0,

maximum = 255,

default value = cond(2 == 1 ? 5 : 10),
endnumeric;
Gao, Liming
2015-06-10 10:04:21 UTC
Permalink
Tim:
How about add one example in VFR spec to explain it?

Thanks
Liming

From: Tim Lewis [mailto:***@insyde.com]
Sent: Wednesday, June 10, 2015 5:11 PM
To: edk2-***@lists.sourceforge.net
Cc: Lawrence Chiu
Subject: Re: [edk2] "cond" vs. ?

Yes. But this is confusing because the VFR specification is not clear. As a result, many programmers assume that the cond() operator will work like the C ? operator.

How do we get the VFR specification updated?

Thanks,

Tim

From: Gao, Liming [mailto:***@intel.com]
Sent: Wednesday, June 10, 2015 5:01 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Cc: Lawrence Chiu
Subject: Re: [edk2] "cond" vs. ?

Lewis:
Second way. If (expr1) then x = expr3 else expr2

Thanks
Liming
From: Tim Lewis [mailto:***@insyde.com]
Sent: Wednesday, June 10, 2015 10:48 AM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Cc: Lawrence Chiu
Subject: [edk2] "cond" vs. ?

Folks -

It appears that the VFR spec is not clear about how the 2nd and 3rd parameters of the "cond" operator are handled.

cond(expr1, expr2, expr3)

Is it: if (expr1) then x = expr2 else expr3

Or

If (expr1) then x = expr3 else expr2

We have seen alternate implementations in the wild.

Thanks,

Tim

The VFR spec says:


conditionalExp ::=

"cond"

"("

vfrStatementExpression

"?"

vfrStatementExpression

":"

vfrStatementExpression

")"

BEHAVIORS AND RESTRICTIONS:

Generates EFI_IFR_CONDITIONAL op-codes.VFR Description in BNF 52

Example:

numeric varid = MyData.Data,

prompt = STRING_TOKEN(STR_PROMPT),

help = STRING_TOKEN(STR_HELP),

minimum = 0,

maximum = 255,

default value = cond(2 == 1 ? 5 : 10),
endnumeric;
Tim Lewis
2015-06-10 10:45:53 UTC
Permalink
There is already an example in the VFR specification. But there is no comment to indicate which is "TRUE" and which is "FALSE"

From: Gao, Liming [mailto:***@intel.com]
Sent: Wednesday, June 10, 2015 6:04 PM
To: edk2-***@lists.sourceforge.net
Cc: Lawrence Chiu
Subject: Re: [edk2] "cond" vs. ?

Tim:
How about add one example in VFR spec to explain it?

Thanks
Liming

From: Tim Lewis [mailto:***@insyde.com]
Sent: Wednesday, June 10, 2015 5:11 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Cc: Lawrence Chiu
Subject: Re: [edk2] "cond" vs. ?

Yes. But this is confusing because the VFR specification is not clear. As a result, many programmers assume that the cond() operator will work like the C ? operator.

How do we get the VFR specification updated?

Thanks,

Tim

From: Gao, Liming [mailto:***@intel.com]
Sent: Wednesday, June 10, 2015 5:01 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Cc: Lawrence Chiu
Subject: Re: [edk2] "cond" vs. ?

Lewis:
Second way. If (expr1) then x = expr3 else expr2

Thanks
Liming
From: Tim Lewis [mailto:***@insyde.com]
Sent: Wednesday, June 10, 2015 10:48 AM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Cc: Lawrence Chiu
Subject: [edk2] "cond" vs. ?

Folks -

It appears that the VFR spec is not clear about how the 2nd and 3rd parameters of the "cond" operator are handled.

cond(expr1, expr2, expr3)

Is it: if (expr1) then x = expr2 else expr3

Or

If (expr1) then x = expr3 else expr2

We have seen alternate implementations in the wild.

Thanks,

Tim

The VFR spec says:


conditionalExp ::=

"cond"

"("

vfrStatementExpression

"?"

vfrStatementExpression

":"

vfrStatementExpression

")"

BEHAVIORS AND RESTRICTIONS:

Generates EFI_IFR_CONDITIONAL op-codes.VFR Description in BNF 52

Example:

numeric varid = MyData.Data,

prompt = STRING_TOKEN(STR_PROMPT),

help = STRING_TOKEN(STR_HELP),

minimum = 0,

maximum = 255,

default value = cond(2 == 1 ? 5 : 10),
endnumeric;
Ard Biesheuvel
2015-06-10 10:48:24 UTC
Permalink
Post by Tim Lewis
There is already an example in the VFR specification. But there is no
comment to indicate which is “TRUE” and which is “FALSE”
Just adding my 2 cents here: I think it's ludicrous to adopt the C
syntax for a conditional expression (i.e., ? and :) but invert the
meaning.

Is there anything that could be done about that?
Post by Tim Lewis
Sent: Wednesday, June 10, 2015 6:04 PM
Cc: Lawrence Chiu
Subject: Re: [edk2] "cond" vs. ?
How about add one example in VFR spec to explain it?
Thanks
Liming
Sent: Wednesday, June 10, 2015 5:11 PM
Cc: Lawrence Chiu
Subject: Re: [edk2] "cond" vs. ?
Yes. But this is confusing because the VFR specification is not clear. As a
result, many programmers assume that the cond() operator will work like the
C ? operator.
How do we get the VFR specification updated?
Thanks,
Tim
Sent: Wednesday, June 10, 2015 5:01 PM
Cc: Lawrence Chiu
Subject: Re: [edk2] "cond" vs. ?
Second way. If (expr1) then x = expr3 else expr2
Thanks
Liming
Sent: Wednesday, June 10, 2015 10:48 AM
Cc: Lawrence Chiu
Subject: [edk2] "cond" vs. ?
Folks –
It appears that the VFR spec is not clear about how the 2nd and 3rd
parameters of the “cond” operator are handled.
cond(expr1, expr2, expr3)
Is it: if (expr1) then x = expr2 else expr3
Or
If (expr1) then x = expr3 else expr2
We have seen alternate implementations in the wild.
Thanks,
Tim
conditionalExp ::=
"cond"
"("
vfrStatementExpression
"?"
vfrStatementExpression
":"
vfrStatementExpression
")"
Generates EFI_IFR_CONDITIONAL op-codes.VFR Description in BNF 52
numeric varid = MyData.Data,
prompt = STRING_TOKEN(STR_PROMPT),
help = STRING_TOKEN(STR_HELP),
minimum = 0,
maximum = 255,
default value = cond(2 == 1 ? 5 : 10),
endnumeric;
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Gao, Liming
2015-06-11 15:42:00 UTC
Permalink
Tim:
Got your point. We will update VFR doc to explain it.

Thanks
Liming
From: Tim Lewis [mailto:***@insyde.com]
Sent: Wednesday, June 10, 2015 6:46 PM
To: edk2-***@lists.sourceforge.net
Cc: Lawrence Chiu
Subject: Re: [edk2] "cond" vs. ?

There is already an example in the VFR specification. But there is no comment to indicate which is "TRUE" and which is "FALSE"

From: Gao, Liming [mailto:***@intel.com]
Sent: Wednesday, June 10, 2015 6:04 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Cc: Lawrence Chiu
Subject: Re: [edk2] "cond" vs. ?

Tim:
How about add one example in VFR spec to explain it?

Thanks
Liming

From: Tim Lewis [mailto:***@insyde.com]
Sent: Wednesday, June 10, 2015 5:11 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Cc: Lawrence Chiu
Subject: Re: [edk2] "cond" vs. ?

Yes. But this is confusing because the VFR specification is not clear. As a result, many programmers assume that the cond() operator will work like the C ? operator.

How do we get the VFR specification updated?

Thanks,

Tim

From: Gao, Liming [mailto:***@intel.com]
Sent: Wednesday, June 10, 2015 5:01 PM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Cc: Lawrence Chiu
Subject: Re: [edk2] "cond" vs. ?

Lewis:
Second way. If (expr1) then x = expr3 else expr2

Thanks
Liming
From: Tim Lewis [mailto:***@insyde.com]
Sent: Wednesday, June 10, 2015 10:48 AM
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Cc: Lawrence Chiu
Subject: [edk2] "cond" vs. ?

Folks -

It appears that the VFR spec is not clear about how the 2nd and 3rd parameters of the "cond" operator are handled.

cond(expr1, expr2, expr3)

Is it: if (expr1) then x = expr2 else expr3

Or

If (expr1) then x = expr3 else expr2

We have seen alternate implementations in the wild.

Thanks,

Tim

The VFR spec says:


conditionalExp ::=

"cond"

"("

vfrStatementExpression

"?"

vfrStatementExpression

":"

vfrStatementExpression

")"

BEHAVIORS AND RESTRICTIONS:

Generates EFI_IFR_CONDITIONAL op-codes.VFR Description in BNF 52

Example:

numeric varid = MyData.Data,

prompt = STRING_TOKEN(STR_PROMPT),

help = STRING_TOKEN(STR_HELP),

minimum = 0,

maximum = 255,

default value = cond(2 == 1 ? 5 : 10),
endnumeric;

Loading...