From: Yonghong Zhu <yonghong.zhu@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>,
Michael Kinney <michael.d.kinney@intel.com>,
Kevin W Shaw <kevin.w.shaw@intel.com>
Subject: [Patch] Expression spec: Add clarification for String compare
Date: Tue, 16 Oct 2018 09:12:15 +0800 [thread overview]
Message-ID: <1539652335-17040-1-git-send-email-yonghong.zhu@intel.com> (raw)
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 <liming.gao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Kevin W Shaw <kevin.w.shaw@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
2_expression_overview.md | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/2_expression_overview.md b/2_expression_overview.md
index c29a632..bf66ffe 100644
--- a/2_expression_overview.md
+++ b/2_expression_overview.md
@@ -1,9 +1,9 @@
<!--- @file
2 Expression Overview
- Copyright (c) 2014-2017, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2014-2018, Intel Corporation. All rights reserved.<BR>
Redistribution and use in source (original document form) and 'compiled'
forms (converted to PDF, epub, HTML and other formats) with or without
modification, are permitted provided that the following conditions are met:
@@ -81,14 +81,17 @@ directives section do not apply.
10. Multiplicative and additive operators require both operands to be
arithmetic in type.
11. Relational and equality operators require both operands to be of the same
- type. Relational comparison on string literals and byte arrays must be
- performed comparing the byte values, left to right. The first pair of bytes
- (or a single extra byte) that is not equal will determine the result of the
- comparison. The following are examples of string comparisons:
+ type. The single quote string and double quote string are same type as
+ general string, while the string start with `L` character is the unicode
+ string. Unicode string should not compare with general string. Relational
+ comparison on string literals and byte arrays must be performed comparing
+ the byte values, left to right. The first pair of bytes (or a single extra
+ byte) that is not equal will determine the result of the comparison. The
+ following are examples of string comparisons:
```
Foo = "zero", Bar = "three";
```
`Foo < Bar` will evaluate to zero (AKA, FALSE), as "z" is greater than "t".
```
--
2.6.1.windows.1
next reply other threads:[~2018-10-16 1:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-16 1:12 Yonghong Zhu [this message]
2018-10-16 6:50 ` [Patch] Expression spec: Add clarification for String compare Gao, Liming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1539652335-17040-1-git-send-email-yonghong.zhu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox