Results 1 to 4 of 4

Thread: [RESOLVED] Datatype size on 64-bit systems.

  1. #1

    Thread Starter
    Fanatic Member ThomasJohnsen's Avatar
    Join Date
    Jul 2010
    Location
    Denmark
    Posts
    528

    Resolved [RESOLVED] Datatype size on 64-bit systems.

    I'm still using ye ancient 32-bit machine with ye olde XP.

    Currently I'm writing some code to add binary content to files, and I need to know, if the same code can be applied on 64-bit systems.
    For example an integer variable added to a binary file with:
    Code:
    BinaryStream.Write(SomeNumberDeclaredAsInteger)
    can be safely loaded with
    Code:
    MyInteger = BinaryStream.ReadInt32
    on my system, but is this also the case on 64-bit systems or should I truncate it to Int32 before writing it to file?

    Thanks in advance for any help with this
    Tom
    In truth, a mature man who uses hair-oil, unless medicinally , that man has probably got a quoggy spot in him somewhere. As a general rule, he can't amount to much in his totality. (Melville: Moby Dick)

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Datatype size on 64-bit systems.

    According to MSDN, the Integer datatype is equivalent to System.Int32. And as the name implies, System.Int32 will be 32 bit on both 32-bit and 64-bit systems.
    This would mean that your code will work alright on a 64-bit system aswell.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Datatype size on 64-bit systems.

    The thing that changes size between 32-bit and 64-bit systems is an IntPtr. It basically represents a memory address, so it will be as wide as that needs.

  4. #4

    Thread Starter
    Fanatic Member ThomasJohnsen's Avatar
    Join Date
    Jul 2010
    Location
    Denmark
    Posts
    528

    Re: Datatype size on 64-bit systems.

    Big thanks to both.

    Thread resolved!
    In truth, a mature man who uses hair-oil, unless medicinally , that man has probably got a quoggy spot in him somewhere. As a general rule, he can't amount to much in his totality. (Melville: Moby Dick)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width