Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Byte Alignment in VC++ 6.0

This topic is 5616 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, i have a question concerning byte alignment. I´m programming a scripting language and my instructions should be variable-sized to keep the code small (for example, a byte-add instruction should only occupie 3 bytes, one for the byte code, and one for each of the two operands, where an longint adds would occupy 9 bytes). but the byte alignment is set by VC++ to a 8 byte boundary, to improve performance, and i have an AMD 1800XP+. Would reducing the boundary to one byte mean heavily peformance hits? I have read that the java byte code format always uses 1-byte boundary alignmemnt. Can someone give me a good advice? thanks Gammastrahler

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Just let your compiler do any kind of aligning it wants. Then when reading in the commands, read each operand/operator separately.

struct A {
char a;
int b; //don''t care about alignment
char c;

ifstream in(..);
A a;
in >> a.a >> a.b >> a.c;

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!