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



  • 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!!!



  • 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++ :-(



  • 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/Cinema4DCPPSDK/html/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



  • 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.



  • 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


Log in to reply