libigl-python-bindings icon indicating copy to clipboard operation
libigl-python-bindings copied to clipboard

What is the meaning of Qu8mg5v7 ?

Open alecjacobson opened this issue 4 years ago • 2 comments

For example

const char *ds_min_quad_with_fixed = R"igl_Qu8mg5v7(

alecjacobson avatar Oct 16 '21 19:10 alecjacobson

It's a raw string literal in C++11. https://stackoverflow.com/a/5460235

In C++11 you have raw string literals. Sort of like here-text in shells and script languages like Python and Perl and Ruby.

const char * vogon_poem = R"V0G0N(
             O freddled gruntbuggly thy micturations are to me
                 As plured gabbleblochits on a lurgid bee.
              Groop, I implore thee my foonting turlingdromes.   
           And hooptiously drangle me with crinkly bindlewurdles,
Or I will rend thee in the gobberwarts with my blurlecruncheon, see if I don't.

                (by Prostetnic Vogon Jeltz; see p. 56/57)
)V0G0N";

All the spaces and indentation and the newlines in the string are preserved.

I should point out that the escape sequence, V0G0N, is not actually needed here. Its presence would allow putting )" inside the string. In other words, I could have put

                "(by Prostetnic Vogon Jeltz; see p. 56/57)"

(note extra quotes) and the string above would still be correct. Otherwise I could just as well have used

const char * vogon_poem = R"( ... )";

The parens just inside the quotes are still needed.

nodtem66 avatar Feb 08 '22 09:02 nodtem66

Sorry for my misunderstanding. That is the purpose of R"igl_Qu8mg5v7(, not the meaning. I think we should ask the author who introduced basic_function.mako @skoch9

https://github.com/libigl/libigl-python-bindings/blame/7e8f2edd7db4e139783c3452402fe173e4f58fdc/scripts/basic_function.mako#L7

nodtem66 avatar Feb 28 '22 03:02 nodtem66

I'm not involved in this project at all, but found this issue via google.

The point of it is that in order to know when the end of the string literal is you need a unique escape sequence that will never appear inside the string itself. It can be anything, but igl_Qu8mg5v7 is likely random and very very unlikely to ever appear in the actual string even if people edit it in the future.

ethanhjennings avatar Dec 09 '23 11:12 ethanhjennings