MS compiler's text-processing
I have a source file (.cpp) that I save into my HD using a different encoding scheme than its original code page. Later I open it again with MSVS and clearly nothing looks different (no odd characters were inserted). But if I add a comment at the end of the file, e.g
Code:
class A{
void func()
{
}
//comment
}
it will report an error of "{" at line "class A{"
But if I change it into
Code:
class A{
void func()
{
}
/*comment*/
}
then the error is gone.
Could you explain why ? Thank you.
BTW, I am looking for a decent compiler book (one that is most applicable to current OSes + MSVS technologies+GnuGcc). Honestly I never took a compiler course before, all of what I know is from one of my best online professors. She was/is/will always be great to me! :) Best! Thank you, professor.
Re: MS compiler's text-processing
Quote:
Originally Posted by
terminalXXX
I have a source file (.cpp) that I save into my HD using a different encoding scheme than its original code page.
Could you clarify what and how you did?
Re: MS compiler's text-processing
Quote:
Originally Posted by
VictorN
Could you clarify what and how you did?
It's not what I did it's someone else did and I wonder why that happened
Re: MS compiler's text-processing
Quote:
Originally Posted by
terminalXXX
It's not what I did it's someone else did and I wonder why that happened
Well, again:
- Which different encoding scheme did "someone else" use?
- How did he/she save in "different encoding scheme"?
- Which one was the original code page?
- Which version of IDE was used?
Re: MS compiler's text-processing
I have a friend that did that, it broke, and then he changed it back and fix it. I have no idea what he did.
Re: MS compiler's text-processing
Quote:
Originally Posted by
Arjay
I have a friend that did that, it broke, and then he changed it back and fix it. I have no idea what he did.
Yes, and that indicates something incompletely implemented in the compiler exists because ther compiler does still accept /*..comment..*/ but not //..comment..
Re: MS compiler's text-processing
Thank you VictorN, I had no idea then,.
Re: MS compiler's text-processing
Quote:
Originally Posted by
terminalXXX
I have a source file (.cpp) that I save into my HD using a different encoding scheme than its original code page. Later I open it again with MSVS and clearly nothing looks different (no odd characters were inserted).
Quote:
Originally Posted by
terminalXXX
Yes, and that indicates something incompletely implemented in the compiler exists because ther compiler does still accept /*..comment..*/ but not //..comment..
No, that indicates that "a different encoding schema", whatever it really is you never let us know, made the code text, though been looking "nothing different" in IDE text editor, be somehow broken at line ends (from compiler code parser perspective of course), and the single line comment made the closing curly brace be commented out along with the line.
Re: MS compiler's text-processing
Well, that makes me think the OP may want to look into something like Windows line termination style (CR LF) vs. *nix line termination (LF only). Just an idea, though...