File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -5737,6 +5737,37 @@ <h3 id="Line_Length">Line Length</h3>
57375737
57385738</ div >
57395739
5740+ < div class ="drake ">
5741+ < h3 id ="Raw_String_Literals "> Raw String Literals</ h3 >
5742+
5743+ < p > Raw string literals provide an easy way to transcribe multi-line C++ string
5744+ constants. The
5745+ < a href ="https://en.cppreference.com/w/cpp/language/string_literal "> string_literal</ a >
5746+ page on cppreference provides details.</ p >
5747+
5748+ < p > When writing multi-line raw string literals in Drake, prefer to use a
5749+ triple-quote formatting as follows:</ p >
5750+
5751+ < pre >
5752+ void foo() {
5753+ const char* x = R"""(
5754+ root:
5755+ value: 1.0
5756+ )""";
5757+ }
5758+ </ pre >
5759+
5760+ < p > In particular, use < tt > ""</ tt > as the < em > delimiter</ em > so that the overall
5761+ effect is three quote marks in a row.</ p >
5762+
5763+ < p > Rationale: To help developers reading our code who are not familiar with raw
5764+ string literals, we use the triple-quote pattern that is a similar to Python's
5765+ multi-line literal. We prefer using a consistent delimiter everywhere so the
5766+ reader only has to learn one simple pattern, instead of exactly how the C++
5767+ parser is specified to match the various allowable delimiters.< p >
5768+
5769+ </ div >
5770+
57405771< h3 id ="Non-ASCII_Characters "> Non-ASCII Characters</ h3 >
57415772
57425773< div class ="summary ">
You can’t perform that action at this time.
0 commit comments