get size of malloc'd object
flaps at utcs.UUCP
flaps at utcs.UUCP
Fri Jun 27 15:36:11 AEST 1986
A way to get a sufficient alignment constant should be as follows:
union ALIGNED {
char garbage0;
unsigned char garbage1;
short garbage2;
int garbage3;
unsigned garbage4;
long garbage5;
unsigned long garbage6;
float garbage7;
double garbage8;
};
(sorry if I've left out any)
Then you can use sizeof(ALIGNED) as the alignment constant. Am I mistaken?
The problem is that this number might be greater than the actual
alignment constant, for example if a "double" has length 8 but only
needs quad-word alignment.
--
Alan J Rosenthal
{decvax|cbosgd|linus}!ihnp4!utcs!flaps, utzoo!utcs!flaps
More information about the Comp.lang.c
mailing list