×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Aug 2004
    Posts
    295

    [defect report] carbide.cpp code formatter can't produce code conforming to s60 style

    To my knowlegde carbide.c++ 1.2.2 code formatter cannot format code so that it is compatible with Nokia "S60 Coding Conventions".

    This is a problem because when one presses ctrl-shift-f to auto-format code, the code will be corrupted to non-standard state. We cannot really change coding conventions to match IDE bugs.

    I've modified the formatting definitions to best match S60 code style. After tweaking, following major problems remain in two categories:

    1) Auto-formatter messes with existing code, and corrupts the formatting
    2) Auto-formatter doesn't mess with existing code, but doesn't do the correct formatting either


    To demostrate category 1 problem, see this:

    I want this:
    Code:
    void CFoo::Foo()
    {
      TInt a( 3 );
      FooBar();
      Test( a );
      Test( TInt( a ) );
    }
    I get this:
    Code:
    void CFoo::Foo( )
    {
      TInt a(3);
      FooBar( );
      Test( a ); // this is the only correct thing
      Test(TInt( a ));
    }
    Problems:
    - Method definition without parameters has incorrectly space between parens
    - TInt a(3) is not correctly formatted to have spaces
    - Method invication without parameters has incorrectly space between parens
    - When TInt( a ) is defined as only parameter to Test, there is no spaces between parens. Things work if Test takes two or more parameters, then the TInt( a ) has proper spaces between parens and commas ( Test( TInt( a ), TInt( a ) ); ).


    Category 2 problem example.

    Let assume if I have code like this.
    Code:
    TInt foo = static_cast<TInt>(3);
    When auto-format is applied, the code looks the same.

    If I add manually the spaces around parens, the auto-formatter won't touch those. So if the code is correct, the auto-formatter won't corrupt it, but if it is wrong, it won't do the right thing either.

    One minor bug:
    setting variable: keep_empty_array_initializer_on_one_line
    - no effect, it splits empty array initializer to multiple lines anyway

    This is the formatter setting .xml that I've used: http://ssalmine.googlepages.com/symb...ersettings.xml

  2. #2
    Regular Contributor
    Join Date
    Aug 2004
    Posts
    295

    Re: [defect report] carbide.cpp code formatter can't produce code conforming to s60 s

    Another bug regarding for statements.

    Let's assume I have code like this:
    Code:
        for ( TInt lol = 0;lol < 4;lol++ )
            {
            }
    I have defined that I want spaces after semicolons. I press auto-format command, and get following:

    Code:
        for ( TInt lol = 0; lol < 4;lol++ )
            {
            }
    Please note that space is added only after first semicolon. If I manully add space ("; lol++"), it remains correct after auto-format. If I add more spaces like "; lol++", it will auto-format it to correct state ("; lol++").

  3. #3
    Registered User
    Join Date
    Dec 2007
    Location
    Kharkiv, Ukraine
    Posts
    21

    Re: [defect report] carbide.cpp code formatter can't produce code conforming to s60 s

    Hello,

    I've posted a solution for Carbide formatting problems. Hope this helps

    http://symbiantricks.info/tricks/a_s...ode_formatter/

    Sergey

Similar Threads

  1. What is going on with Vibration on S60?
    By amd_rikus in forum Mobile Java General
    Replies: 3
    Last Post: 2006-06-16, 00:29
  2. Replies: 9
    Last Post: 2006-03-30, 08:36

Posting Permissions

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