C Structure Alignment Problem + C/C++
Posted: Sun Aug 07, 2005 11:00 pm
Dear All,
I'm working on a Suse Linux OS on i386 Arch. Using BOCHS Emulator
for developing the hobby OS.
I'v two Questions...
1) QUERY 1?
if a declare a structure as
struct IDTR
{
unsigned short limit ; //2 bytes
unsigned base ;//4 bytes
} ;
I See that limit is allocated address an 0x100 (say) then
base is alligned at 0x104 when is is suppose to be at 0x102.
The gcc compiler which i'm using is aligning at int boundaries
and i didn't find any gcc option to avoid this for i386 Arch (But
-mno-align-double is supported). But for other Arch like Power PC,
Etc... -mno-align-int is available...
Is there a way to force GCC not to align on int boundaries.....
2) QUERY 2?
What are the Advatages/DisAdvantages of using C for developing an OS kernel?
What are the Advatages/DisAdvantages of using C++ for developing an OS kernel?
I'm working on a Suse Linux OS on i386 Arch. Using BOCHS Emulator
for developing the hobby OS.
I'v two Questions...
1) QUERY 1?
if a declare a structure as
struct IDTR
{
unsigned short limit ; //2 bytes
unsigned base ;//4 bytes
} ;
I See that limit is allocated address an 0x100 (say) then
base is alligned at 0x104 when is is suppose to be at 0x102.
The gcc compiler which i'm using is aligning at int boundaries
and i didn't find any gcc option to avoid this for i386 Arch (But
-mno-align-double is supported). But for other Arch like Power PC,
Etc... -mno-align-int is available...
Is there a way to force GCC not to align on int boundaries.....
2) QUERY 2?
What are the Advatages/DisAdvantages of using C for developing an OS kernel?
What are the Advatages/DisAdvantages of using C++ for developing an OS kernel?