0

There is a snippet of code I took from an example and it uses a symbol unknown to me, namely », and I can not find anything about it! The snippet is split onto two lines, but if I remove the split in the string, it doesn't throw an error, assumingly because » then becomes part of the "..." string.

cout << "Running 'SELECT 'Hello World!' »
   AS _message'..." << endl;

However, another usage of the symbol not involved directly in a string throws an error as well:

cout << "(" << __FUNCTION__ << ") on line " »
   << __LINE__ << endl;

Is this bad syntax for just continuation of a string?

Quentin
  • 62,093
  • 7
  • 131
  • 191
Mir
  • 30
  • 8
  • Your question is unclear. Read about [function name](https://gcc.gnu.org/onlinedocs/gcc/Function-Names.html) in GCC documentation. See also [this answer](http://stackoverflow.com/a/597081/841108) to a near duplicate question. – Basile Starynkevitch Dec 29 '16 at 09:03
  • Also `»` is not a valid character in C++11 code (outside of literal strings, literal chars, and comments). Did you enable all warnings & debug info (e.g. `g++ -Wall -Wextra -g` if using [GCC](http://gcc.gnu.org/)...) in your compiler? What are the *exact* diagnostics?? – Basile Starynkevitch Dec 29 '16 at 09:05
  • Thank you, I think that answers my question. BTW, The whole code example can be found here on Oracle's website: https://dev.mysql.com/doc/connector-cpp/en/connector-cpp-examples-complete-example-1.html – Mir Dec 29 '16 at 09:06
  • You probably should signal a bug (very probably a documentation bug) to Oracle. – Basile Starynkevitch Dec 29 '16 at 09:08
  • And yes, I do have all warnings and Wextra enabled for GCC. I am using codeblocks. – Mir Dec 29 '16 at 09:08
  • The only error thrown is for not terminating a string: connect.cpp|43|error: missing terminating " character| – Mir Dec 29 '16 at 09:10
  • » is alt code (alt+175). But the error is not due to this . If you press 'enter' in between then this will become non terminating string. – Anurag Singh Dec 29 '16 at 09:28
  • 1
    This is a [guillemet](https://en.wikipedia.org/wiki/Guillemet), and has no business floating around in C++ code. This is definitely an issue with the website. – Quentin Dec 29 '16 at 09:58
  • Thanks for that information @Quentin, I am glad someone was able to find out what it was! – Mir Dec 30 '16 at 05:12

0 Answers0