@@ -3510,6 +3510,25 @@ itself can be evaluated at compilation time. This restriction is
35103510designed to ensure that the width of the result of the conditional
35113511expression can be inferred statically at compile time.
35123512
3513+ [#sec-string-ops]
3514+ === Operations on strings
3515+
3516+ The only operation allowed on strings is concatenation, denoted by
3517+ `++`. For string concatenation, both operands must be strings and
3518+ the result is also a string. String concatenation can only be
3519+ performed at compile time.
3520+
3521+ [source,p4]
3522+ ----
3523+ extern void log(string message);
3524+
3525+ void foo(int<8> v) {
3526+ // ...
3527+ log("my log message " ++
3528+ "continuation of the log message");
3529+ }
3530+ ----
3531+
35133532[#sec-bit-ops]
35143533=== Operations on fixed-width bit types (unsigned integers)
35153534
@@ -3861,25 +3880,6 @@ finding this information in a section dedicated to type `varbit`.
38613880
38623881Additionally, the maximum size of a variable-length bit-string can be determined at compile-time (<<sec-minsizeinbits>>).
38633882
3864- [#sec-string-ops]
3865- === Operations on strings
3866-
3867- The only operation allowed on strings is concatenation, denoted by
3868- `++`. For string concatenation, both operands must be strings and
3869- the result is also a string. String concatenation can only be
3870- performed at compile time.
3871-
3872- [source,p4]
3873- ----
3874- extern void log(string message);
3875-
3876- void foo(int<8> v) {
3877- // ...
3878- log("my log message " ++
3879- "continuation of the log message");
3880- }
3881- ----
3882-
38833883[#sec-casts]
38843884=== Casts
38853885
0 commit comments