Project forums > Q-Gears

Does anyone know how set struct aligment to 1 byte in Dev-C++?

(1/2) > >>

Akari:
subj.

sfx1999:
IIRC, the default compiler setting aligns to 32-bit. It gives better performance, IIRC. Anyway, you can get a set of commands to use by using gcc --help in a command prompt.

Synergy Blades:
Had this problem with sizeof() giving incorrect size of structures.


--- Code: ---#pragma pack(1)
--- End code ---

..fixed it.

sfx1999:
Isn't it faster to align 32-bit though?

Akari:

--- Quote from: Synergy Blades on 2006-05-17 21:34:22 ---Had this problem with sizeof() giving incorrect size of structures.


--- Code: ---#pragma pack(1)
--- End code ---

..fixed it.

--- End quote ---

Thanks, it helps.


--- Quote ---Isn't it faster to align 32-bit though?
--- End quote ---

This is needed for writing binary files to disk. Save screenshot for example =)

Navigation

[0] Message Index

[#] Next page

Go to full version