Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. totally confused about UINT_PTR

totally confused about UINT_PTR

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 4 Posters 0 Views 1 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.
  • S Offline
    S Offline
    Saurabh Garg
    wrote on last edited by
    #1

    can someone please explaing what type is UINT_PTR. Is it pointer to unsigned integer or just an alias for unsigned integer? :~ after looking in basetsd.h file I found it is defined as : typedef _W64 int INT_PTR; so it seems it is unsigned integer, but then why people at microsoft has choosen such an ambiguous name for it or is it just PTR doesnt mean pointer and I am misinterpreting it. :^) thanks -Saurabh -- modified at 4:03 Friday 4th November, 2005

    J S Q 3 Replies Last reply
    0
    • S Saurabh Garg

      can someone please explaing what type is UINT_PTR. Is it pointer to unsigned integer or just an alias for unsigned integer? :~ after looking in basetsd.h file I found it is defined as : typedef _W64 int INT_PTR; so it seems it is unsigned integer, but then why people at microsoft has choosen such an ambiguous name for it or is it just PTR doesnt mean pointer and I am misinterpreting it. :^) thanks -Saurabh -- modified at 4:03 Friday 4th November, 2005

      J Offline
      J Offline
      Johann Gerell
      wrote on last edited by
      #2

      Use INT_PTR and UINT_PTR when casting a pointer to something else and you want to express that it's casted to something with the same size as a pointer. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win64/win64/the_new_data_types.asp[^] http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/windows_data_types.asp[^] -- The Blog: Bits and Pieces

      1 Reply Last reply
      0
      • S Saurabh Garg

        can someone please explaing what type is UINT_PTR. Is it pointer to unsigned integer or just an alias for unsigned integer? :~ after looking in basetsd.h file I found it is defined as : typedef _W64 int INT_PTR; so it seems it is unsigned integer, but then why people at microsoft has choosen such an ambiguous name for it or is it just PTR doesnt mean pointer and I am misinterpreting it. :^) thanks -Saurabh -- modified at 4:03 Friday 4th November, 2005

        S Offline
        S Offline
        S Senthil Kumar
        wrote on last edited by
        #3

        Like Johann said, it's used to treat a pointer as an UINT. There's INT_PTR, which treats the pointer as an INT and so on. Pretty useful for writing platform independent code. Simply casting a pointer to unsigned int won't work on a 64 bit platform, for example. Regards Senthil _____________________________ My Blog | My Articles | WinMacro

        1 Reply Last reply
        0
        • S Saurabh Garg

          can someone please explaing what type is UINT_PTR. Is it pointer to unsigned integer or just an alias for unsigned integer? :~ after looking in basetsd.h file I found it is defined as : typedef _W64 int INT_PTR; so it seems it is unsigned integer, but then why people at microsoft has choosen such an ambiguous name for it or is it just PTR doesnt mean pointer and I am misinterpreting it. :^) thanks -Saurabh -- modified at 4:03 Friday 4th November, 2005

          Q Offline
          Q Offline
          qfegd
          wrote on last edited by
          #4

          There is 2 definitions for UINT_PTR: if _WIN64 is defined it is a unsigned __int64 (a integer on 64 bit) if not it is defined as an unsigned int (a integer on 32 bit) Eric

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups