@@ -3510,6 +3510,25 @@ itself can be evaluated at compilation time. This restriction is
3510
3510
designed to ensure that the width of the result of the conditional
3511
3511
expression can be inferred statically at compile time.
3512
3512
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
+
3513
3532
[#sec-bit-ops]
3514
3533
=== Operations on fixed-width bit types (unsigned integers)
3515
3534
@@ -3861,25 +3880,6 @@ finding this information in a section dedicated to type `varbit`.
3861
3880
3862
3881
Additionally, the maximum size of a variable-length bit-string can be determined at compile-time (<<sec-minsizeinbits>>).
3863
3882
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
-
3883
3883
[#sec-casts]
3884
3884
=== Casts
3885
3885
0 commit comments