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. Byte Ordering MFC Serialization [Solved]

Byte Ordering MFC Serialization [Solved]

Scheduled Pinned Locked Moved C / C++ / MFC
c++comjsonquestionlounge
6 Posts 2 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.
  • G Offline
    G Offline
    Garth Watkins
    wrote on last edited by
    #1

    Does the serialization class CArchive automatically handle byte ordering differences on different platforms ? I have a class which i am serializing on an Big Endian platform but will be deserializing it on a little endian platform. Is there anything i need to watch out for ? The only bit of info i have managed to find on the net is this article http://www.drdobbs.com/184409538;jsessionid=T1RL5VK3F2RBFQE1GHPCKHWATMY32JVN?_requestid=488503[^] However it is a bit outdated. [Solution] OK for those who are interested, it seems as if CArchive does not do any byte swapping at all. The reason being is that all versions of windows run the same endianess.. http://social.msdn.microsoft.com/Forums/en/windowsmobiledev/thread/04c92ef9-e38e-415f-8958-ec9f7c196fd3[^] The two items in the CArchive class that would have anything to do with byte swapping actually do nothing at all. i.e. CArchive::IsByteSwapping and CArchive::bNoByteSwap

    Cheers Garth I don't really care whether or not i really care or not.

    modified on Tuesday, March 2, 2010 6:29 AM

    C 1 Reply Last reply
    0
    • G Garth Watkins

      Does the serialization class CArchive automatically handle byte ordering differences on different platforms ? I have a class which i am serializing on an Big Endian platform but will be deserializing it on a little endian platform. Is there anything i need to watch out for ? The only bit of info i have managed to find on the net is this article http://www.drdobbs.com/184409538;jsessionid=T1RL5VK3F2RBFQE1GHPCKHWATMY32JVN?_requestid=488503[^] However it is a bit outdated. [Solution] OK for those who are interested, it seems as if CArchive does not do any byte swapping at all. The reason being is that all versions of windows run the same endianess.. http://social.msdn.microsoft.com/Forums/en/windowsmobiledev/thread/04c92ef9-e38e-415f-8958-ec9f7c196fd3[^] The two items in the CArchive class that would have anything to do with byte swapping actually do nothing at all. i.e. CArchive::IsByteSwapping and CArchive::bNoByteSwap

      Cheers Garth I don't really care whether or not i really care or not.

      modified on Tuesday, March 2, 2010 6:29 AM

      C Offline
      C Offline
      CPallini
      wrote on last edited by
      #2

      Well, you may perform a little test. :) [added] I guess the outdated article's content is still true (at least for compatibility reasons). [/added]

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      G 1 Reply Last reply
      0
      • C CPallini

        Well, you may perform a little test. :) [added] I guess the outdated article's content is still true (at least for compatibility reasons). [/added]

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        G Offline
        G Offline
        Garth Watkins
        wrote on last edited by
        #3

        Well....I'm just taking the easy way out ;) Actually i was hoping someone had already performed a little test already. And i also don't currently have access to the little endian platform.

        Cheers Garth I don't really care whether or not i really care or not.

        C 1 Reply Last reply
        0
        • G Garth Watkins

          Well....I'm just taking the easy way out ;) Actually i was hoping someone had already performed a little test already. And i also don't currently have access to the little endian platform.

          Cheers Garth I don't really care whether or not i really care or not.

          C Offline
          C Offline
          CPallini
          wrote on last edited by
          #4

          Garth Watkins wrote:

          And i also don't currently have access to the little endian platform.

          You don't need: just see, with you fovourite hex editor, if the binary file is properly 'little-endianned'... :rolleyes:

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          G 1 Reply Last reply
          0
          • C CPallini

            Garth Watkins wrote:

            And i also don't currently have access to the little endian platform.

            You don't need: just see, with you fovourite hex editor, if the binary file is properly 'little-endianned'... :rolleyes:

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            G Offline
            G Offline
            Garth Watkins
            wrote on last edited by
            #5

            How is that going to help ? Lets say for instance i serialize class to a file. I then open the file in a hex editor. That's going to tell me what format (Little Endian/Big Endian) the CArchive class saves data in. It's not going to tell me whether or not it gets restored in the proper way when deserializing it on another platform that has a different byte order.

            Cheers Garth I don't really care whether or not i really care or not.

            C 1 Reply Last reply
            0
            • G Garth Watkins

              How is that going to help ? Lets say for instance i serialize class to a file. I then open the file in a hex editor. That's going to tell me what format (Little Endian/Big Endian) the CArchive class saves data in. It's not going to tell me whether or not it gets restored in the proper way when deserializing it on another platform that has a different byte order.

              Cheers Garth I don't really care whether or not i really care or not.

              C Offline
              C Offline
              CPallini
              wrote on last edited by
              #6

              Garth Watkins wrote:

              That's going to tell me what format (Little Endian/Big Endian) the CArchive class saves data in. It's not going to tell me whether or not it gets restored in the proper way when deserializing it on another platform that has a different byte order.

              It should serialize it in little-endian format. That way you may be pretty confident it will work on other platforms (as quick-test result 'pretty confident' is good, anyway, I suppose checking the endianess is a bit painful). I would say (based on Dr.Dobb's article): if you don't make mistakes, it will work. :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              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