Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Wrong indentation of if ?!?! What is wrong?

    Cinema 4D SDK
    sdk r21
    3
    5
    591
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rui_mac
      last edited by

      I have this snippet of code:

          for (f = 0; f < 32; f++)
          {
              ch = user_id.GetPart(0, 1);
              
              if (ch != "-")
              { the_id = the_id + ch; }
          }
      

      And it keeps telling me that there is a "wrong indentation of if", no matter how I indent the "if" statement.
      How can I possibly indent the "if" statement to make Xcode stop telling me that the "if" is badly indented?
      Damn, these new limitations of composition are very strict!!!

      1 Reply Last reply Reply Quote 0
      • R
        rui_mac
        last edited by

        I'm getting lots and lots of errors complaining about wrong indentation.
        Damn!!! It almost looks like I'm programming with python, instead of C++ 😞

        1 Reply Last reply Reply Quote 0
        • kbarK
          kbar
          last edited by kbar

          Hi rui_mac,

          Would be helpful if you posted up the actual errors you are getting.

          That being said I have never heard of this problem before. Must be some very strict style guide setting enabled somewhere. My advice would be to just disable them.

          In your definitions.txt file just set

          stylecheck=false

          https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_projecttool.html#page_maxonapi_projecttool_definition_stylecheck

          Now looking at your code above I would think the style guide is requiring the code to look something like this

          for (f = 0; f < 32; f++)
          {
              ch = user_id.GetPart(0, 1);   
          
              if (ch != "-")
              { 
                  the_id = the_id + ch;
              }
          }
          

          Kent

          https://www.gamelogicdesign.com
          https://www.plugins4d.com

          1 Reply Last reply Reply Quote 0
          • R
            rui_mac
            last edited by

            I set the stylecheck.level to zero and the complains about the indentation disappeared.
            I also tried that type of structure but the error still appeared, when the stylecheck.level was set to 3.
            Now I'm getting different types of errors.

            1 Reply Last reply Reply Quote 0
            • r_giganteR
              r_gigante
              last edited by

              Hi Rui, thanks for reaching out us.

              With regard to your issue, I confirm that whilst VS is more "tolerant" with regard to code-style check, Xcode is less.
              The code style check, which is embedded in our source processor, expects tabs rather than spaces for code indentation and it could happen that either Tabs has not be set in Xcode preferences, as preferred indentation method, or that you've copied and pasted some portion of code that was indented with spaces.

              Please check your indentations for using tabs rather than switching off completely the style check.

              Best, R

              1 Reply Last reply Reply Quote 0
              • First post
                Last post