delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/07/09/22:39:00

Date: Wed, 9 Jul 2003 22:12:00 -0400 (EDT)
From: The Shadow <ericp AT ariel DOT minilab DOT bdeb DOT qc DOT ca>
To: djgpp AT delorie DOT com
Subject: Question about Djgpp : Data Alignment
Message-ID: <Pine.LNX.4.44.0307092203070.23044-100000@ariel.minilab.bdeb.qc.ca>
MIME-Version: 1.0

Hi

	I want to know if it is possible to tell the compiler not to place
any padding in data structures to allign the data on word or dword.

	For example, if I make a sizeof of the struct bellow, I will
obtain a size of 4 bytes instead of 3 bytes :

typedef unsigned char byte;
typedef unsigned short word;

typedef struc s_test_struct
{
   byte var1;
   word var2;
}s_test_struct;

sizeof ( s_test_struct ) is 4.

	In this case, it add a byte of padding between the 2 variables to
make sure var2 is word aligned.

	If there an option in DJGPP that can allow the compiler to ingnore
the data alignment and the padding process. Or is is possible to specify
somehow that the struct s_test_struct should not receive any padding.


				Thank you for considering my request

							Sayonara (^_^)

							The Shadow

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019