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 ?
Forum Updated to NodeBB v4.3 + New Features

Maximum value for unsigned int ?

Scheduled Pinned Locked Moved Solved General and Desktop
uint value max
6 Posts 3 Posters 8.7k 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 13 Sept 2018, 09:04 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 1 Reply Last reply 13 Sept 2018, 09:08
    0
    • S Selzig
      13 Sept 2018, 09:04

      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 Online
      J Online
      J.Hilk
      Moderators
      wrote on 13 Sept 2018, 09:08 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 13 Sept 2018, 09:14 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
        • V Offline
          V Offline
          VRonin
          wrote on 13 Sept 2018, 09:23 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 1 Reply Last reply 13 Sept 2018, 09:26
          3
          • V VRonin
            13 Sept 2018, 09:23

            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 Online
            J Online
            J.Hilk
            Moderators
            wrote on 13 Sept 2018, 09:26 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 13 Sept 2018, 09:36 last edited by
              #6

              Thank you both for this informations.
              Regards. Gilles

              1 Reply Last reply
              0

              1/6

              13 Sept 2018, 09:04

              • Login

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