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. Use of the word 'or' instead of double pipe '||'
Forum Updated to NodeBB v4.3 + New Features

Use of the word 'or' instead of double pipe '||'

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 8 Posters 1.1k Views 5 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.
  • J.HilkJ Offline
    J.HilkJ Offline
    J.Hilk
    Moderators
    wrote on last edited by
    #6

    I don't understand all the hate for the alternative tokens, personally I would prefer them over the cryptic characters :D

    especially as I work with a Mac and a Windows VM and the character keys are differently mapped for pipe and backslash and tilde etc.


    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


    Q: What's that?
    A: It's blue light.
    Q: What does it do?
    A: It turns blue.

    JonBJ 1 Reply Last reply
    1
    • J.HilkJ J.Hilk

      I don't understand all the hate for the alternative tokens, personally I would prefer them over the cryptic characters :D

      especially as I work with a Mac and a Windows VM and the character keys are differently mapped for pipe and backslash and tilde etc.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #7

      @J-Hilk said in Use of the word 'or' instead of double pipe '||':

      I don't understand all the hate for the alternative tokens, personally I would prefer them over the cryptic characters :D

      Are you serious? You prefer to write code using "features" that 99+% of all existing code/users out there do not use? E.g. witness this question the OP has raised, indicating that he had no idea or would work. Or, default MSVC does not support. Maybe it's OK if it's only you who codes --- and you never copy/paste it into a question at stackoverflow!

      C used nicely obscure symbols to keep the hoi polloi out of programming so that people like me could make a living --- and long may that last! ;-)

      J.HilkJ 1 Reply Last reply
      1
      • JonBJ JonB

        @J-Hilk said in Use of the word 'or' instead of double pipe '||':

        I don't understand all the hate for the alternative tokens, personally I would prefer them over the cryptic characters :D

        Are you serious? You prefer to write code using "features" that 99+% of all existing code/users out there do not use? E.g. witness this question the OP has raised, indicating that he had no idea or would work. Or, default MSVC does not support. Maybe it's OK if it's only you who codes --- and you never copy/paste it into a question at stackoverflow!

        C used nicely obscure symbols to keep the hoi polloi out of programming so that people like me could make a living --- and long may that last! ;-)

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by J.Hilk
        #8

        @JonB it is not a pure C feature, it is officially part of C++ :P

        https://en.cppreference.com/w/cpp/language/operator_alternative

        and matter of fact, when I read code, I actually read or and and etc and not, pipe pipe and and :P

        my personal favourite:
        ??-


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        Christian EhrlicherC JonBJ 2 Replies Last reply
        0
        • J.HilkJ J.Hilk

          @JonB it is not a pure C feature, it is officially part of C++ :P

          https://en.cppreference.com/w/cpp/language/operator_alternative

          and matter of fact, when I read code, I actually read or and and etc and not, pipe pipe and and :P

          my personal favourite:
          ??-

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #9

          @J-Hilk said in Use of the word 'or' instead of double pipe '||':

          it is not a pure C feature, it is officially part of C++

          Sadly...

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          1
          • J.HilkJ J.Hilk

            @JonB it is not a pure C feature, it is officially part of C++ :P

            https://en.cppreference.com/w/cpp/language/operator_alternative

            and matter of fact, when I read code, I actually read or and and etc and not, pipe pipe and and :P

            my personal favourite:
            ??-

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #10

            @J-Hilk said in Use of the word 'or' instead of double pipe '||':

            @JonB it is not a pure C feature, it is officially part of C++ :P
            https://en.cppreference.com/w/cpp/language/operator_alternative

            I know this since I referenced

            and https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B for C++

            ! It's just they were originally introduced in C.

            @Christian-Ehrlicher said in Use of the word 'or' instead of double pipe '||':

            Sadly...

            Exactly!

            1 Reply Last reply
            0
            • Chris KawaC Offline
              Chris KawaC Offline
              Chris Kawa
              Lifetime Qt Champion
              wrote on last edited by
              #11

              I don't understand all the hate for the alternative tokens

              Maybe for few people it is but I wouldn't call it hate in general. Every programming language goes through stages and one of them is hashing out which features become the "canon" of it and which are to be left on the wayside and forgotten. For alternative logic operators this ship has sailed couple of decades ago and there's absolutely no value in trying to turn it around. Someone liking this or that syntax more is irrelevant at this point. Very few people know about this feature, even fewer use it and it's almost never being taught. Even if you like it the best thing to do is let it die its natural death of obscurity, so that it can be removed at some point, like trigraphs were in C++17 after a looooong time. A simpler language with fewer syntactical options to do the same thing in different ways is far more valuable. I would gladly send this feature to a chopping block just because it's redundant at this point, not because I dislike the syntax.

              1 Reply Last reply
              1
              • fcarneyF Offline
                fcarneyF Offline
                fcarney
                wrote on last edited by
                #12

                What about array indexes? You can do "fun" things with those too:

                int array[5] = {0,1,2,3,4};
                2[array] = 17;
                array[3] = 200;
                qDebug() << array;
                for(int ind=0; ind<5; ++ind){
                    qDebug() << ind[array];
                }
                

                Its just pointer math, but it is fun.

                C++ is a perfectly valid school of magic.

                Chris KawaC 1 Reply Last reply
                1
                • Kent-DorfmanK Offline
                  Kent-DorfmanK Offline
                  Kent-Dorfman
                  wrote on last edited by
                  #13

                  @fcarney said in Use of the word 'or' instead of double pipe '||':

                  2[array] = 17;

                  Bad engineer! No cookie!

                  I light my way forward with the fires of all the bridges I've burned behind me.

                  artwawA 1 Reply Last reply
                  3
                  • Kent-DorfmanK Kent-Dorfman

                    @fcarney said in Use of the word 'or' instead of double pipe '||':

                    2[array] = 17;

                    Bad engineer! No cookie!

                    artwawA Offline
                    artwawA Offline
                    artwaw
                    wrote on last edited by
                    #14

                    @Kent-Dorfman you owe me a clean cloth to clean my display <3

                    For more information please re-read.

                    Kind Regards,
                    Artur

                    1 Reply Last reply
                    0
                    • fcarneyF fcarney

                      What about array indexes? You can do "fun" things with those too:

                      int array[5] = {0,1,2,3,4};
                      2[array] = 17;
                      array[3] = 200;
                      qDebug() << array;
                      for(int ind=0; ind<5; ++ind){
                          qDebug() << ind[array];
                      }
                      

                      Its just pointer math, but it is fun.

                      Chris KawaC Offline
                      Chris KawaC Offline
                      Chris Kawa
                      Lifetime Qt Champion
                      wrote on last edited by Chris Kawa
                      #15

                      @fcarney C++ has grown to be a very versatile language. It can be used to solve "real world" engineering problem, teach someone to code, enter one of these for fun code contests and much more. That type of code is good for one of these tasks at least :)

                      https://youtu.be/DEqXNfs_HhY

                      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