CompuServe Messages

C structure size

    04-Jun-90 19:26:01
Sb: #107647-C structure size
Fm: Harry Callesis 72025,117
To: Mike Roth/Lattice 76566,1137
Mike – I tried the -w option in the compile as you suggested, and it made no difference. The structure with the three char fields gives a sizeof() of 3, and the structure with the 4 4-bit fields gives a sizeof() of 4. I was hoping the second structure would be 2 bytes (16 bits) as described since I wanted to traverse a word (16-bit) array as an array of these structures. I ended up having to use masks and shifts to do the job (though that's probably what the compiler would have generated anyway). I'm not sure if it's even worth looking into, since there _are_ workarounds, but it's certainly not what I expected. Anyway, I've made a note in my manual in case I forget 8^). If you do find out anything about this, I would be interested in knowing. Thanks … Harry