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. Maximum value for unsigned int ?
QtWS25 Last Chance

Maximum value for unsigned int ?

Scheduled Pinned Locked Moved Solved General and Desktop
uint value max
6 Posts 3 Posters 8.3k 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.
  • S Offline
    S Offline
    Selzig
    wrote on last edited by Selzig
    #1

    Hello,

    qDebug() << QString::number(std::numeric_limits<unsigned int>::max());
    

    return 4294967295 with my mac OS X[64 bits]. Is it the same for all target platforms of Qt ?
    In other words, can is it the same value with windows 32&64, linux 32&64, ios, android ? I guess so, but I prefer to check with you ?
    Thanks. Regards. Gilles

    J.HilkJ 1 Reply Last reply
    0
    • S Selzig

      Hello,

      qDebug() << QString::number(std::numeric_limits<unsigned int>::max());
      

      return 4294967295 with my mac OS X[64 bits]. Is it the same for all target platforms of Qt ?
      In other words, can is it the same value with windows 32&64, linux 32&64, ios, android ? I guess so, but I prefer to check with you ?
      Thanks. Regards. Gilles

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

      hi @Selzig ,

      sadly you can not, the standard int may have 2 or 4 bytes depending on the platform/compiler used.

      but you can ensure, that it is 4 bytes, by using int32_t or qint32


      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
      2
      • S Offline
        S Offline
        Selzig
        wrote on last edited by
        #3

        @J.Hilk said in Maximum value for unsigned int ?:

        sadly you can not, the standard int may have 2 or 4 bytes depending on the platform/compiler used.
        but you can ensure, that it is 4 bytes, by using int32_t or qint32Hello,

        Thank you for your reply. Could you clarify me in which case is it 2 bytes on the platforms mentioned ?
        Thanks. Gilles

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by VRonin
          #4

          Actually, as I discovered with surprise, Qt only supports systems where int is 4 bytes so yes, that result is guaranteed.

          The difference between 64 and 32 bits versions is the definition of qintptr

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          J.HilkJ 1 Reply Last reply
          3
          • VRoninV VRonin

            Actually, as I discovered with surprise, Qt only supports systems where int is 4 bytes so yes, that result is guaranteed.

            The difference between 64 and 32 bits versions is the definition of qintptr

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

            @VRonin said in Maximum value for unsigned int ?:

            Actually, as I discovered with surprise Qt only supports systems where int is 4 bytes so yes, that result is guaranteed.

            Look at that, you learn something new every day 😲!


            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
            • S Offline
              S Offline
              Selzig
              wrote on last edited by
              #6

              Thank you both for this informations.
              Regards. Gilles

              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