CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Jun 2012
    Posts
    38

    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.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: MS compiler's text-processing

    Quote Originally Posted by terminalXXX View Post
    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?
    Victor Nijegorodov

  3. #3
    Join Date
    Jun 2012
    Posts
    38

    Re: MS compiler's text-processing

    Quote Originally Posted by VictorN View Post
    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

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: MS compiler's text-processing

    Quote Originally Posted by terminalXXX View Post
    It's not what I did it's someone else did and I wonder why that happened
    Well, again:
    1. Which different encoding scheme did "someone else" use?
    2. How did he/she save in "different encoding scheme"?
    3. Which one was the original code page?
    4. Which version of IDE was used?
    Victor Nijegorodov

  5. #5
    Join Date
    Jun 2012
    Posts
    38

    Re: MS compiler's text-processing

    Thank you VictorN, I had no idea then,.

  6. #6
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    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.

  7. #7
    Join Date
    Jun 2012
    Posts
    38

    Re: MS compiler's text-processing

    Quote Originally Posted by Arjay View Post
    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..
    Last edited by terminalXXX; June 28th, 2013 at 09:36 PM.

  8. #8
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: MS compiler's text-processing

    Quote Originally Posted by terminalXXX View Post
    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 View Post
    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.
    Last edited by Igor Vartanov; June 29th, 2013 at 01:38 AM.
    Best regards,
    Igor

  9. #9
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    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...
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured