Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Creator, syntax checking do not recognize gcc extensions.
Forum Updated to NodeBB v4.3 + New Features

Qt Creator, syntax checking do not recognize gcc extensions.

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.2k Views 2 Watching
  • 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.
  • X Offline
    X Offline
    xtech
    wrote on last edited by xtech
    #1

    Is there any way to turn off or add special case to Qt Creator syntax checking? I ask because now when I use for example gcc "Case Ranges" extension like

    switch( size ) {
        case 1:
            // do x
        break;
        case 2 ... 255:
            // do y
        break;
        case 256 ... 512:
            // do z
        break;
    }
    

    0_1480771471865_upload-ba18a049-62e7-4249-afe1-4c0a6816fe76

    Qt Creator 4.1.1 show red underline warning which disturb reading code.

    kshegunovK 1 Reply Last reply
    0
    • X xtech

      Is there any way to turn off or add special case to Qt Creator syntax checking? I ask because now when I use for example gcc "Case Ranges" extension like

      switch( size ) {
          case 1:
              // do x
          break;
          case 2 ... 255:
              // do y
          break;
          case 256 ... 512:
              // do z
          break;
      }
      

      0_1480771471865_upload-ba18a049-62e7-4249-afe1-4c0a6816fe76

      Qt Creator 4.1.1 show red underline warning which disturb reading code.

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      I don't think you can fix the underline in creator, no. Why not use a simple if-else and not rely on non-standard extensions?

      if (size == 1)
          // do x
      else if (size >= 2 && size <= 255)
         // do y
      // ... and so on
      

      Read and abide by the Qt Code of Conduct

      X 1 Reply Last reply
      1
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #3

        Hi
        I support @kshegunov recommendation to not use those extensions.
        However, there is the following feature
        (Tools->Options menu)
        alt text

        You can change how the error underlining should look and hence also remove it.
        Simply COPY the color theme and u can alter it.

        However this applies to all cases so not optimal but its still marked in the side so
        you are not killing the feature completely.

        1 Reply Last reply
        1
        • kshegunovK kshegunov

          I don't think you can fix the underline in creator, no. Why not use a simple if-else and not rely on non-standard extensions?

          if (size == 1)
              // do x
          else if (size >= 2 && size <= 255)
             // do y
          // ... and so on
          
          X Offline
          X Offline
          xtech
          wrote on last edited by xtech
          #4

          @kshegunov

          Because as far as I know, switch can be sometimes better optimized by compiler and for me switch is more readable but it is a matter of taste.

          I also think that this extension should be in standard, but that is another matter.
          I report this behavior of Qt Creator to Qt Team as suggestion maybe it something will change...

          Thanks all,

          kshegunovK 1 Reply Last reply
          0
          • X xtech

            @kshegunov

            Because as far as I know, switch can be sometimes better optimized by compiler and for me switch is more readable but it is a matter of taste.

            I also think that this extension should be in standard, but that is another matter.
            I report this behavior of Qt Creator to Qt Team as suggestion maybe it something will change...

            Thanks all,

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by
            #5

            @xtech said in Qt Creator, syntax checking do not recognize gcc extensions.:

            Because as far as I know, switch can be sometimes better optimized by compiler

            Not in this particular case.

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved