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. QByteArray and char type
Forum Update on Monday, May 27th 2025

QByteArray and char type

Scheduled Pinned Locked Moved Solved General and Desktop
58 Posts 9 Posters 10.0k Views
  • 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.
  • JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by JonB
    #1

    I was struck by something when reading @stretchthebits comment at https://forum.qt.io/topic/118343/qbytearray-range-issue/8

    QByteArray seems to be just an array of char, which are signed values.

    In other words, the range is from -128 to 127.

    My immediate reaction was: this must be wrong, it will be an array of unsigned char. But he is correct, and it has methods like char() which return char *, and nothing native which deals with unsigned char *.

    Now, I understand this is convenient because it is used to interact fairly seamlessly with char arrays and QString types. However, that is not what "byte" means, and in all other languages/toolkits which use a "byte" type that is always an unsigned 8-bit char type.

    There may not be much to say about my observation, but I am surprised Qt has chosen to call a signed char type QByteArray. That seems to me a misnomer, and its usage is "unusual". It also means that I don't see any Qt type for natively handling byte/unsigned char type, you have to do casting? Which also surprises me among all the convenience types that Qt does provide.

    Any comments from the Qt experts?

    J.HilkJ JKSHJ 2 Replies Last reply
    0
    • JonBJ JonB

      I was struck by something when reading @stretchthebits comment at https://forum.qt.io/topic/118343/qbytearray-range-issue/8

      QByteArray seems to be just an array of char, which are signed values.

      In other words, the range is from -128 to 127.

      My immediate reaction was: this must be wrong, it will be an array of unsigned char. But he is correct, and it has methods like char() which return char *, and nothing native which deals with unsigned char *.

      Now, I understand this is convenient because it is used to interact fairly seamlessly with char arrays and QString types. However, that is not what "byte" means, and in all other languages/toolkits which use a "byte" type that is always an unsigned 8-bit char type.

      There may not be much to say about my observation, but I am surprised Qt has chosen to call a signed char type QByteArray. That seems to me a misnomer, and its usage is "unusual". It also means that I don't see any Qt type for natively handling byte/unsigned char type, you have to do casting? Which also surprises me among all the convenience types that Qt does provide.

      Any comments from the Qt experts?

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

      @JonB answer from one of the maintainers:
      https://bugreports.qt.io/browse/QTBUG-64746


      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
      4
      • J.HilkJ J.Hilk

        @JonB answer from one of the maintainers:
        https://bugreports.qt.io/browse/QTBUG-64746

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

        @J-Hilk
        OK, yep! Seems I am not the only one who has noticed this/commented that it is "strange". Of course I understand I can make everything work with casting/uchar/uint8_t etc., but that's not the point. Seems Qt would have been better naming it QCharArray, since that is more accurate than QByteArray, by normal naming conventions.

        I guess there's no more than that to say....

        I'll leave this open for a day in case anyone else wishes to comment.

        aha_1980A 1 Reply Last reply
        0
        • JonBJ JonB

          @J-Hilk
          OK, yep! Seems I am not the only one who has noticed this/commented that it is "strange". Of course I understand I can make everything work with casting/uchar/uint8_t etc., but that's not the point. Seems Qt would have been better naming it QCharArray, since that is more accurate than QByteArray, by normal naming conventions.

          I guess there's no more than that to say....

          I'll leave this open for a day in case anyone else wishes to comment.

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @JonB Better would be to comment on my bugreport.

          I still have hope that QByteArray one day will be ... an array of bytes.

          Qt has to stay free or it will die.

          JonBJ 1 Reply Last reply
          0
          • aha_1980A aha_1980

            @JonB Better would be to comment on my bugreport.

            I still have hope that QByteArray one day will be ... an array of bytes.

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

            @aha_1980
            I didn't know that was you! There's nothing to say, as they're clearly never going to change existing QByteArray behaviour from char to unsigned char given how long it has been that way!

            aha_1980A 1 Reply Last reply
            0
            • JonBJ JonB

              @aha_1980
              I didn't know that was you! There's nothing to say, as they're clearly never going to change existing QByteArray behaviour from char to unsigned char given how long it has been that way!

              aha_1980A Offline
              aha_1980A Offline
              aha_1980
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @JonB Indeed. Therefore I think the possible way would be to add functionality. Do you think that would be feasible?

              Qt has to stay free or it will die.

              JonBJ 1 Reply Last reply
              0
              • aha_1980A aha_1980

                @JonB Indeed. Therefore I think the possible way would be to add functionality. Do you think that would be feasible?

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

                @aha_1980
                Well, given that they are not going to want to change any existing behaviour: they could introduce, say, a byte() method to correspond to the current data() method, to return unsigned char * instead of char *. But there are a lot of existing methods which accept/return something in chars not unsigned chars. In particular operator overload char operator[](int i) const (and char at(int i) const) already returns char, so in practical/convenient terms the horse has already bolted....

                aha_1980A 1 Reply Last reply
                0
                • JonBJ JonB

                  @aha_1980
                  Well, given that they are not going to want to change any existing behaviour: they could introduce, say, a byte() method to correspond to the current data() method, to return unsigned char * instead of char *. But there are a lot of existing methods which accept/return something in chars not unsigned chars. In particular operator overload char operator[](int i) const (and char at(int i) const) already returns char, so in practical/convenient terms the horse has already bolted....

                  aha_1980A Offline
                  aha_1980A Offline
                  aha_1980
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @JonB yeah, you would effectively double the API.

                  Another idea that came to my mind was a compatible class so you can easily convert QByteArray to QDataArray and then work on uchar. I have not investigated that much, though.

                  Qt has to stay free or it will die.

                  J.HilkJ 1 Reply Last reply
                  0
                  • aha_1980A aha_1980

                    @JonB yeah, you would effectively double the API.

                    Another idea that came to my mind was a compatible class so you can easily convert QByteArray to QDataArray and then work on uchar. I have not investigated that much, though.

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

                    @aha_1980 said in QByteArray and char type:

                    @JonB yeah, you would effectively double the API.

                    Another idea that came to my mind was a compatible class so you can easily convert QByteArray to QDataArray and then work on uchar. I have not investigated that much, though.

                    you would still need to touch QByteArray and add constructor & operators that accept QDataArray, no?

                    which would blow up the api as well


                    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
                    0
                    • J.HilkJ J.Hilk

                      @aha_1980 said in QByteArray and char type:

                      @JonB yeah, you would effectively double the API.

                      Another idea that came to my mind was a compatible class so you can easily convert QByteArray to QDataArray and then work on uchar. I have not investigated that much, though.

                      you would still need to touch QByteArray and add constructor & operators that accept QDataArray, no?

                      which would blow up the api as well

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

                      @J-Hilk , @aha_1980
                      Playing with QByteArrray, I now have a couple of observations/questions.

                          QByteArray b;
                          b.resize(1);
                          b[0] = 128;
                          if (b[0] >= 127)
                              qDebug() << "Yes (1)";
                          if (b.at(0) >= 127)
                              qDebug() << "Yes (2)";
                      

                      As an observation: neither of these outputs "Yes". This (or similar code) is the danger of the existing implementation being used by someone, unaware that they will not produce what is (presumably) the "expected" result, given that he assumes he is dealing with "bytes".

                      This produces a warning (gcc, 9.3.0) on the if (b[0] >= 127) line only:

                      ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second

                      [Don't know who wrote that message, but it's cryptic in the extreme!]

                      Question: why does [] produce this warning but at() does not?

                      J.HilkJ JKSHJ 2 Replies Last reply
                      0
                      • JonBJ JonB

                        @J-Hilk , @aha_1980
                        Playing with QByteArrray, I now have a couple of observations/questions.

                            QByteArray b;
                            b.resize(1);
                            b[0] = 128;
                            if (b[0] >= 127)
                                qDebug() << "Yes (1)";
                            if (b.at(0) >= 127)
                                qDebug() << "Yes (2)";
                        

                        As an observation: neither of these outputs "Yes". This (or similar code) is the danger of the existing implementation being used by someone, unaware that they will not produce what is (presumably) the "expected" result, given that he assumes he is dealing with "bytes".

                        This produces a warning (gcc, 9.3.0) on the if (b[0] >= 127) line only:

                        ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second

                        [Don't know who wrote that message, but it's cryptic in the extreme!]

                        Question: why does [] produce this warning but at() does not?

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

                        @JonB clang is actually a bit more detailed

                        main.cpp:88:18: error: use of overloaded operator '>=' is ambiguous (with operand types 'QByteRef' and 'int')
                        qbytearray.h:554:17: note: candidate function
                        main.cpp:88:18: note: built-in candidate operator>=(int, int)
                        main.cpp:88:18: note: built-in candidate operator>=(float, int)
                        main.cpp:88:18: note: built-in candidate operator>=(double, int)
                        main.cpp:88:18: note: built-in candidate operator>=(long double, int)
                        main.cpp:88:18: note: built-in candidate operator>=(int, float)
                        main.cpp:88:18: note: built-in candidate operator>=(int, double)
                        ...
                        main.cpp:88:18: note: built-in candidate operator>=(unsigned __int128, unsigned long)
                        main.cpp:88:18: note: built-in candidate operator>=(unsigned __int128, unsigned long long)
                        main.cpp:88:18: note: built-in candidate operator>=(unsigned __int128, unsigned __int128)
                        
                        

                        and it's true, the operator overload of [] for QByteArray returns either a QByteRef or a char so, its ambiguous

                        where as at() is guaranteed to be of the type char

                        also, I get an warning for the implicit conversion so 🤷‍♂️

                        b3269447-0676-411e-9538-de07c9e18014-image.png

                        make this if (b[0] >= 127) explicitly a char not an implicit int, and the warning should go away

                        if (b[0] >= char(127))
                        

                        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

                          @JonB clang is actually a bit more detailed

                          main.cpp:88:18: error: use of overloaded operator '>=' is ambiguous (with operand types 'QByteRef' and 'int')
                          qbytearray.h:554:17: note: candidate function
                          main.cpp:88:18: note: built-in candidate operator>=(int, int)
                          main.cpp:88:18: note: built-in candidate operator>=(float, int)
                          main.cpp:88:18: note: built-in candidate operator>=(double, int)
                          main.cpp:88:18: note: built-in candidate operator>=(long double, int)
                          main.cpp:88:18: note: built-in candidate operator>=(int, float)
                          main.cpp:88:18: note: built-in candidate operator>=(int, double)
                          ...
                          main.cpp:88:18: note: built-in candidate operator>=(unsigned __int128, unsigned long)
                          main.cpp:88:18: note: built-in candidate operator>=(unsigned __int128, unsigned long long)
                          main.cpp:88:18: note: built-in candidate operator>=(unsigned __int128, unsigned __int128)
                          
                          

                          and it's true, the operator overload of [] for QByteArray returns either a QByteRef or a char so, its ambiguous

                          where as at() is guaranteed to be of the type char

                          also, I get an warning for the implicit conversion so 🤷‍♂️

                          b3269447-0676-411e-9538-de07c9e18014-image.png

                          make this if (b[0] >= 127) explicitly a char not an implicit int, and the warning should go away

                          if (b[0] >= char(127))
                          
                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on last edited by JonB
                          #12

                          @J-Hilk
                          Damn! A certain person (I'm looking at you, @mrjj :) ) told me to switch off Clang in Qt Creator and go for the editing experience without. (Partly, IIRC, because of Clang's ridiculous ordering of proposed completions for method names, which makes it awful to use.) So, like a lamb to the slaughter, I have followed his advice, and do not get that information about which overload of [] it was going for....

                          So, off topic, but: in view of this, would you, @J-Hilk, or others, advise me to revert to the default of Clang being on? :)

                          J.HilkJ 1 Reply Last reply
                          0
                          • JonBJ JonB

                            @J-Hilk
                            Damn! A certain person (I'm looking at you, @mrjj :) ) told me to switch off Clang in Qt Creator and go for the editing experience without. (Partly, IIRC, because of Clang's ridiculous ordering of proposed completions for method names, which makes it awful to use.) So, like a lamb to the slaughter, I have followed his advice, and do not get that information about which overload of [] it was going for....

                            So, off topic, but: in view of this, would you, @J-Hilk, or others, advise me to revert to the default of Clang being on? :)

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

                            @JonB said in QByteArray and char type:

                            So, off topic, but: in view of this, would you, @J-Hilk, or others, advise me to revert to the default of Clang being on? :)

                            IMHO the inclusion/support for clang as greatly improved, since its first introduction.
                            In the beginning, I also turned it of, and for about a year or so it's on by default (for me). And for me I had more positive experience with it then (hardly any) negative ones.

                            So, turn it on:D


                            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

                              @JonB said in QByteArray and char type:

                              So, off topic, but: in view of this, would you, @J-Hilk, or others, advise me to revert to the default of Clang being on? :)

                              IMHO the inclusion/support for clang as greatly improved, since its first introduction.
                              In the beginning, I also turned it of, and for about a year or so it's on by default (for me). And for me I had more positive experience with it then (hardly any) negative ones.

                              So, turn it on:D

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

                              @J-Hilk
                              Thanks for advice. This is all @mrjj's fault ;-)

                              Then I have a question (to which I suspect I already know the answer, unfortunately). I use method-name completion all the time. Without Clang on the suggestions are alphabetical, which is good to navigate. But with Clang (last time I looked, anyway) the order is "pseudo-random" ;-) Algorithm for ordering might make sense to a machine, but not to a human.... Do you not find this an issue?

                              J.HilkJ 1 Reply Last reply
                              0
                              • JonBJ JonB

                                @J-Hilk
                                Thanks for advice. This is all @mrjj's fault ;-)

                                Then I have a question (to which I suspect I already know the answer, unfortunately). I use method-name completion all the time. Without Clang on the suggestions are alphabetical, which is good to navigate. But with Clang (last time I looked, anyway) the order is "pseudo-random" ;-) Algorithm for ordering might make sense to a machine, but not to a human.... Do you not find this an issue?

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

                                @JonB it still does that, I'm not sure why and you could probably make your own plugin to sort it before showing if it really bothers you :D

                                But usually I know the beginning of the method so I type the first 2 letters which usually is enough to narrow the selection down to a hand full of options 😉


                                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.

                                1 Reply Last reply
                                0
                                • JonBJ JonB

                                  I was struck by something when reading @stretchthebits comment at https://forum.qt.io/topic/118343/qbytearray-range-issue/8

                                  QByteArray seems to be just an array of char, which are signed values.

                                  In other words, the range is from -128 to 127.

                                  My immediate reaction was: this must be wrong, it will be an array of unsigned char. But he is correct, and it has methods like char() which return char *, and nothing native which deals with unsigned char *.

                                  Now, I understand this is convenient because it is used to interact fairly seamlessly with char arrays and QString types. However, that is not what "byte" means, and in all other languages/toolkits which use a "byte" type that is always an unsigned 8-bit char type.

                                  There may not be much to say about my observation, but I am surprised Qt has chosen to call a signed char type QByteArray. That seems to me a misnomer, and its usage is "unusual". It also means that I don't see any Qt type for natively handling byte/unsigned char type, you have to do casting? Which also surprises me among all the convenience types that Qt does provide.

                                  Any comments from the Qt experts?

                                  JKSHJ Offline
                                  JKSHJ Offline
                                  JKSH
                                  Moderators
                                  wrote on last edited by
                                  #16

                                  @JonB said in QByteArray and char type:

                                  I am surprised Qt has chosen to call a signed char type QByteArray.

                                  Be aware that char and signed char are different types in C++: https://stackoverflow.com/questions/436513/char-signed-char-char-unsigned-char . int is guaranteed to be signed but char is not!

                                  For ARM CPUs, char is unsigned by default: https://developer.arm.com/documentation/dui0491/i/C-and-C---Implementation-Details/Character-sets-and-identifiers -- "The ARM ABI defines char as an unsigned byte, and this is the interpretation used by the C++ libraries supplied with the ARM compilation tools"

                                  Seems Qt would have been better naming it QCharArray, since that is more accurate than QByteArray, by normal naming conventions.

                                  I'd say @aha_1980's "QDataArray" name would work better than "QCharArray". To me, a "char array" is more related to historical text strings than binary data... and QByteArray is intended to be a container of binary data (i.e. bytes). I have no problems with its current name; I just treat the char as an implementation detail (albeit a leaky one)

                                  This (or similar code) is the danger of the existing implementation being used by someone, unaware that they will not produce what is (presumably) the "expected" result, given that he assumes he is dealing with "bytes".

                                  What is the meaning of doing an inequality comparison between a byte and a number? 127 is not a byte.

                                  they could introduce, say, a byte() method to correspond to the current data() method, to return unsigned char * instead of char *.

                                  I don't see much point in switching from char to unsigned char. If we're to initiate a switch, let's do things properly and switch to std::byte.

                                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                  JonBJ J.HilkJ 2 Replies Last reply
                                  2
                                  • JKSHJ JKSH

                                    @JonB said in QByteArray and char type:

                                    I am surprised Qt has chosen to call a signed char type QByteArray.

                                    Be aware that char and signed char are different types in C++: https://stackoverflow.com/questions/436513/char-signed-char-char-unsigned-char . int is guaranteed to be signed but char is not!

                                    For ARM CPUs, char is unsigned by default: https://developer.arm.com/documentation/dui0491/i/C-and-C---Implementation-Details/Character-sets-and-identifiers -- "The ARM ABI defines char as an unsigned byte, and this is the interpretation used by the C++ libraries supplied with the ARM compilation tools"

                                    Seems Qt would have been better naming it QCharArray, since that is more accurate than QByteArray, by normal naming conventions.

                                    I'd say @aha_1980's "QDataArray" name would work better than "QCharArray". To me, a "char array" is more related to historical text strings than binary data... and QByteArray is intended to be a container of binary data (i.e. bytes). I have no problems with its current name; I just treat the char as an implementation detail (albeit a leaky one)

                                    This (or similar code) is the danger of the existing implementation being used by someone, unaware that they will not produce what is (presumably) the "expected" result, given that he assumes he is dealing with "bytes".

                                    What is the meaning of doing an inequality comparison between a byte and a number? 127 is not a byte.

                                    they could introduce, say, a byte() method to correspond to the current data() method, to return unsigned char * instead of char *.

                                    I don't see much point in switching from char to unsigned char. If we're to initiate a switch, let's do things properly and switch to std::byte.

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

                                    @JKSH said in QByteArray and char type:
                                    I was not aware that char is no longer defined as signed (God bless C). Thank you for pointing that out.

                                    What is the meaning of doing an inequality comparison between a byte and a number? 127 is not a byte.

                                    Given the use of the word "byte" in QByteArray, I am (arrogantly) confident that since

                                        QByteArray b;
                                        b.resize(1);
                                        b[0] = 128;
                                        if (b.at(0) >= 127)
                                            qDebug() << "Yes";
                                    

                                    goes through gcc without warning and does not produce "Yes" it will catch people out, if I could look through a whole bunch of people's code.... It's an observation. In part inspired from the confusion shown in the https://forum.qt.io/topic/118343/qbytearray-range-issue thread.

                                    1 Reply Last reply
                                    0
                                    • JKSHJ JKSH

                                      @JonB said in QByteArray and char type:

                                      I am surprised Qt has chosen to call a signed char type QByteArray.

                                      Be aware that char and signed char are different types in C++: https://stackoverflow.com/questions/436513/char-signed-char-char-unsigned-char . int is guaranteed to be signed but char is not!

                                      For ARM CPUs, char is unsigned by default: https://developer.arm.com/documentation/dui0491/i/C-and-C---Implementation-Details/Character-sets-and-identifiers -- "The ARM ABI defines char as an unsigned byte, and this is the interpretation used by the C++ libraries supplied with the ARM compilation tools"

                                      Seems Qt would have been better naming it QCharArray, since that is more accurate than QByteArray, by normal naming conventions.

                                      I'd say @aha_1980's "QDataArray" name would work better than "QCharArray". To me, a "char array" is more related to historical text strings than binary data... and QByteArray is intended to be a container of binary data (i.e. bytes). I have no problems with its current name; I just treat the char as an implementation detail (albeit a leaky one)

                                      This (or similar code) is the danger of the existing implementation being used by someone, unaware that they will not produce what is (presumably) the "expected" result, given that he assumes he is dealing with "bytes".

                                      What is the meaning of doing an inequality comparison between a byte and a number? 127 is not a byte.

                                      they could introduce, say, a byte() method to correspond to the current data() method, to return unsigned char * instead of char *.

                                      I don't see much point in switching from char to unsigned char. If we're to initiate a switch, let's do things properly and switch to std::byte.

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

                                      @JKSH said in QByteArray and char type:

                                      I don't see much point in switching from char to unsigned char. If we're to initiate a switch, let's do things properly and switch to std::byte.

                                      is someone(tm) where to make the changes, like @aha_1980 suggested in this bug report: https://bugreports.qt.io/browse/QTBUG-64746

                                      you would prefer std::byte over unsigned char ?

                                      Because Thiago was against scope creep, and adding std::byte and unsigned char probably falls in that category


                                      that said, std::byte would make that Qt Version require c++17 or later. I'm not sure, that's ok, or not ?


                                      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.

                                      aha_1980A JKSHJ 2 Replies Last reply
                                      0
                                      • J.HilkJ J.Hilk

                                        @JKSH said in QByteArray and char type:

                                        I don't see much point in switching from char to unsigned char. If we're to initiate a switch, let's do things properly and switch to std::byte.

                                        is someone(tm) where to make the changes, like @aha_1980 suggested in this bug report: https://bugreports.qt.io/browse/QTBUG-64746

                                        you would prefer std::byte over unsigned char ?

                                        Because Thiago was against scope creep, and adding std::byte and unsigned char probably falls in that category


                                        that said, std::byte would make that Qt Version require c++17 or later. I'm not sure, that's ok, or not ?

                                        aha_1980A Offline
                                        aha_1980A Offline
                                        aha_1980
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #19

                                        Good morning @J-Hilk,

                                        that said, std::byte would make that Qt Version require c++17 or later. I'm not sure, that's ok, or not ?

                                        That is no problem, as Qt 6 requires C++17.

                                        But as std::byte is also with limited scope (no arithmetic) I'm not sure it is a general solution...

                                        Qt has to stay free or it will die.

                                        J.HilkJ 1 Reply Last reply
                                        0
                                        • aha_1980A aha_1980

                                          Good morning @J-Hilk,

                                          that said, std::byte would make that Qt Version require c++17 or later. I'm not sure, that's ok, or not ?

                                          That is no problem, as Qt 6 requires C++17.

                                          But as std::byte is also with limited scope (no arithmetic) I'm not sure it is a general solution...

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

                                          @aha_1980 good morning to you too!

                                          That is no problem, as Qt 6 requires C++17.

                                          where did you get that from ? I spend like 30 min searching for any reference and didn't find anything :(


                                          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.

                                          aha_1980A 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