Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Linux Servers

Support::Linux Servers Support forum for Linux EQEMu users.

Reply
 
Thread Tools Display Modes
  #1  
Old 01-29-2012, 05:05 AM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

The C, and consequentially C++ standard only requires that a type have a minimum size, not a maximum. An unsigned long is guaranteed to hold a value of 0 to 4294967295, which requires 32 bits. An unsigned int is guaranteed to hold a value of 0 to 65535, or 16 bits, but on most 32-bit platforms it is 32 bits as well because that is the fastest register size on that platform.

In your case, it's clear that unsigned long is 64-bits. As far as I know, on Linux, an unsigned int is 32 bits for both 32-bit and 64-bit programs. On Windows, unsigned long is also 32 bits for both.

C99 and C++ 11 define various guaranteed size types, but multiplatform support for both standards is a bit sketchy, so if you go down that road you may run into problems. I believe GCC has supported the C99 types for a while, but Visual Studio did not include the header until VC++ 10.

If you're really lucky, when you change that to unsigned int you'll get 12, 4, 4, 8 as the output from that program which is what you're looking for. If the offsets are different than that you'll need to add #pragma pack(push, 1), #pragma pack(pop) around the struct definition to force it.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 11:15 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3