This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC 2.96 shows bogus memory allocation when allocating some givenstructs?


Hi Claudio,

For alignment purposes, the compiler may stick in some padding bytes.

If the designers of C wanted to be cruel, they could have forced you to put
in the necessary padding or generate a compile time error.

struct s2
{
  char a[6];
  char pad[2];
  int b;
};

But they figured that was an implementation detail that the compiler could
do for you.

HTH,
--Eljay




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]