Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6935073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:03:15+00:00 2026-05-27T12:03:15+00:00

According to MSDN , the /Zp command defaults to 8, which means 64-bit alignment

  • 0

According to MSDN, the /Zp command defaults to 8, which means 64-bit alignment boundaries are used. I have always assumed that for 32-bit applications, the MSVC compiler will use 32-bit boundaries. For example:

struct Test
{
   char foo;
   int bar;
};

The compiler will pad it like so:

struct Test
{
   char foo;
   char padding[3];
   int bar;
};

So, since /Zp8 is used by default, does that mean my padding becomes 7+4 bytes using the same example above:

struct Test
{
   char foo;
   char padding1[7];
   int bar;
   char padding2[4];
}; // Structure has 16 bytes, ending on an 8-byte boundary

This is a bit ridiculous isn’t it? Am I misunderstanding? Why is such a large padding used, it seems like a waste of space. Most types on a 32-bit system aren’t even going to use 64-bits, so the majority of variables would have padding (probably over 80%).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:03:16+00:00Added an answer on May 27, 2026 at 12:03 pm

    That’s not how it works. Members are aligned to a multiple of their size. Char to 1 byte, short to 2, int to 4, double to 8. The structure is padded at the end to ensure the members still align correctly when the struct is used in an array.

    A packing of 8 means it stops trying to align members that are larger than 8. Which is a practical limit, the memory allocator doesn’t return addresses aligned better than 8. And double is brutally expensive if it isn’t aligned properly and ends up straddling a cache line. But otherwise a headache if you write SIMD code, it requires 16 byte alignment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

CSDL includes elements Documentation/Summary and Documentation/LongDescription that, according to MSDN , can be used
According this MSDN article HttpApplication .EndRequest can be used to close or dispose of
According to MSDN , a hash function must have the following properties: If two
HttpResponse.End() seems to throw an exception according to msdn. Right now i have the
A SorteDictionary is according to MSDN sorted on the key. Does that mean that
According to MSDN on DateTime.ToString ToString(s) should always return string in the format of
According to MSDN , [The pipe name] must have the following form: \\.\pipe\pipename The
According to msdn Enums cannot have a base type of char. Why can enums
According to MSDN SecureString contents is encrypted for additional safety so that if the
According to MSDN you have to create a non-blocking socket like this: unsigned nonblocking

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.