Skip to content

Commit 8eec747

Browse files
author
Yonghong Zhu
committed
Expression spec: Add clarification for String compare
Relational and equality operators require both operands to be of the same type. Treat the string 'A' and "A" as same type, but for "A" and L"A" are not same type since one is general string, another is unicode string. Cc: Liming Gao <[email protected]> Cc: Michael Kinney <[email protected]> Cc: Kevin W Shaw <[email protected]> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu <[email protected]> Reviewed-by: Liming Gao <[email protected]>
1 parent 3f72103 commit 8eec747

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

2_expression_overview.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--- @file
22
2 Expression Overview
33
4-
Copyright (c) 2014-2017, Intel Corporation. All rights reserved.<BR>
4+
Copyright (c) 2014-2018, Intel Corporation. All rights reserved.<BR>
55
66
Redistribution and use in source (original document form) and 'compiled'
77
forms (converted to PDF, epub, HTML and other formats) with or without
@@ -83,10 +83,13 @@ directives section do not apply.
8383
arithmetic in type.
8484

8585
11. Relational and equality operators require both operands to be of the same
86-
type. Relational comparison on string literals and byte arrays must be
87-
performed comparing the byte values, left to right. The first pair of bytes
88-
(or a single extra byte) that is not equal will determine the result of the
89-
comparison. The following are examples of string comparisons:
86+
type. The single quote string and double quote string are same type as
87+
general string, while the string start with `L` character is the unicode
88+
string. Unicode string should not compare with general string. Relational
89+
comparison on string literals and byte arrays must be performed comparing
90+
the byte values, left to right. The first pair of bytes (or a single extra
91+
byte) that is not equal will determine the result of the comparison. The
92+
following are examples of string comparisons:
9093
```
9194
Foo = "zero", Bar = "three";
9295
```

0 commit comments

Comments
 (0)