2
theRunners[i] |= (1ULL << (((runnerList)atoll(token)) – 1ULL));

Why is the line giving the following strange error?

error: stray ‘\226’ in program

What's wrong?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Suresh Atta
  • 120,458
  • 37
  • 198
  • 307
  • In some extended ASCII character sets this is an "n dash" - you probably typed this instead of a normal hyphen (or your text editor did it automatically). You can actually see it's not a normal hyphen if you look closely. – Paul R Nov 06 '15 at 08:13
  • One notable extended ASCII character with that property is Windows codepage 1252, which is the default codepage used by an extremely large number of Windows installations. –  Nov 06 '15 at 08:14
  • Sometimes it also occurs to me in some text editors when I accidentaly press press a control key (like CTRL, ALT...) along with a regular one (like "space"). It "translates" to such characters. – mamahuhu Nov 06 '15 at 08:16
  • The real duplicate is the canonical *[Compilation error: stray ‘\302’ in program, etc.](https://stackoverflow.com/questions/19198332)*. – Peter Mortensen Mar 06 '21 at 15:03
  • Was there only one stray (‘\226’)? Not three, like \226, \136, and \146? – Peter Mortensen Mar 06 '21 at 20:20
  • OK, it could be the single 226 (octal) / 0x96. Not UTF-8, but [CE/CP-1250](https://en.wikipedia.org/wiki/Windows-1250)'s. Corresponding to U+2013 [EN DASH](https://www.utf8-chartable.de/unicode-utf8-table.pl?start=8192&number=128). – Peter Mortensen Aug 04 '21 at 00:01

1 Answers1

7

In the text you have pasted: the sign is actually the character 0x96, which in the Windows-1252 code page is a sort of hyphen.

You must use the ASCII minus sign instead; try deleting that piece of code and re-typing it.

Make sure you are using a plaintext editor - some word processors will automatically change punctuation to "funky" alternative versions.

M.M
  • 138,810
  • 21
  • 208
  • 365
  • @KemyLand copy-pasting his line into a textfile shows me the `0x96` , in fact it is the hyphen .. try again. Perhaps your browser or whatever is doing some translation. – M.M Nov 06 '15 at 08:15
  • @KemyLand Then you're checking with a different encoding. Try converting to Windows codepage 1252, and you'll see it really is 0x96. Note that it *isn't* latin1: latin1 refers to ISO-8859-1, which doesn't define 0x96. –  Nov 06 '15 at 08:16
  • @hvd: I'm using ZSH, thus UTF-8 encoding. If I pass that dash alone, I do get the `0x96`. – 3442 Nov 06 '15 at 08:17
  • @hvd my reference was [this page](http://www.idautomation.com/product-support/ascii-chart-char-set.html) - is that page wrong? – M.M Nov 06 '15 at 08:18
  • @M.M The character list there is not wrong, just the name. There is no such thing as "ISO 1252 Latin-1". There is [ISO-8859-1](https://en.wikipedia.org/wiki/ISO/IEC_8859-1), which is latin1, and there is [Windows-1252](https://en.wikipedia.org/wiki/Windows-1252), which extends ISO-8859-1, but is not itself any ISO standard. –  Nov 06 '15 at 08:20
  • @hvd OK, thanks for the correction – M.M Nov 06 '15 at 08:24
  • I removed that line and re typed – Suresh Atta Nov 06 '15 at 08:28
  • Unicode equivalent U+2013 ([EN DASH](https://www.utf8-chartable.de/unicode-utf8-table.pl?start=8192&number=128)). – Peter Mortensen Mar 06 '21 at 20:35