peter koch <> wrote:
>
> wrote:
>> Thanks so much. Padding of the struct will bring it up to the
>> next multiple of the word size, eg. 32bit/4byte
>>
>> Cheers,
>> Simon
>>
>> --
>> Stupendous Tales
>> www.stupendoustales.com
>> Speculative Fiction, Pulp Dreams
> The statements in the link given in a previous post were not entirely
> accurate. Basically, padding occurs because the underlying CPU either
> requires or prefers a given alignment when reading/writing fundamental
> types. This is not necesarrily the same size as the word size. One
> example is the newer x86 processors where an optimal reading of doubles
> requires the double to be aligned on an 8 byte boundary. Thus
> struct s { char c; double d; } will most likely occupy 16 bytes.
>
> /Peter
>
My teacher has given me no background such as this.
This is the 2nd course in the 2 course intro to programming. The
1st course used to be C++, but now it is Java, so the low level
programming techniques that used to be covered in the 1st course
are lost. But the teacher has not adjusted the 2nd course
appropriately. Maddening. Though I guess its always better to
learn on your own.
Cheers
Simon
--
Stupendous Tales
www.stupendoustales.com
Speculative Fiction, Pulp Dreams