Results 1 to 2 of 2

Thread: Creator indentation loses context

  1. #1
    Join Date
    Jun 2010
    Posts
    4
    Thanks
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Creator indentation loses context

    Hi there,

    Not sure if this was brought up before, but here's the thing, consider following schema:
    Qt Code:
    1. /* some commented code /* level two commented code */
    To copy to clipboard, switch view to plain text mode 

    For example:
    Qt Code:
    1. /* proper comment */
    2. void f1(int b){
    3. int x = b;
    4. }
    5.  
    6. //magic indentation below ;)
    7.  
    8. /* double comment
    9. /* that I'd like to have */
    10. void f2(int c){
    11. int notHere = c;
    12. if (c == 1){
    13. int evenWorse = 4;
    14. }
    15. }
    To copy to clipboard, switch view to plain text mode 

    Code like this will compile as normal, but Creator's auto-indentation loses context as you can see in lines 10-15.

    Not sure if it is a bug, maybe that kind of comments should not be used at all (but why?).

    The compiler gives a warning about this.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Creator indentation loses context

    You can't nest comments. It's a convention thing. Better avoid them.

  3. The following user says thank you to Lykurg for this useful post:

    melon (9th August 2010)

Similar Threads

  1. code indentation
    By jajdoo in forum Newbie
    Replies: 0
    Last Post: 17th July 2010, 16:33
  2. xemacs for qt indentation
    By lni in forum Qt Programming
    Replies: 1
    Last Post: 7th March 2010, 05:15
  3. Qt 'loses' connections...?
    By sebastian.f in forum Newbie
    Replies: 6
    Last Post: 17th July 2009, 10:53
  4. Replies: 3
    Last Post: 5th March 2009, 07:27
  5. Implementation of right indentation in a text editor
    By sukanyarn in forum Qt Programming
    Replies: 11
    Last Post: 26th September 2006, 13:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.