33 lines
897 B
Plaintext
Raw Permalink Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
Cumulatively, saved keystrokes can add up to a lot of saved time. Or at least it can feel that way. So the difference between using ``++L#macro_arg++`` and ``++L###macro_arg++`` to create a wide string literal may seem perfectly justified because MSVC yields the same result for each. But if you ever need to switch to another compiler, that saved time - and then some - will be lost. So it's best to use the cross-compiler standard from the start.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,cpp]
2021-04-28 16:49:39 +02:00
----
#define MY_WIDE_CONSTANT_MAP(x) my_wide_constant_string_map[x] = L#x;
----
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,cpp]
2021-04-28 16:49:39 +02:00
----
#define MY_WIDE_CONSTANT_MAP(x) my_wide_constant_string_map[x] = L###x;
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Use "L###xxx" instead.
endif::env-github,rspecator-view[]