Subject: Use of sizeof()
To: None <>
From: Gordon W. Ross <>
List: current-users
Date: 07/11/1995 20:16:43
> From: Robert Black <>
> Date: Tue, 11 Jul 1995 10:47:11 +0100

> I have a question for anyone with intimate knowledge of the K&R C standard.
What standard?  There is only a de-facto "K&R C standard"...
(As far as I have ever heard anyway, you have ANSI C or no standard.)

> There is some code in NetBSD (generic SCSI is one place) which makes
> assumptions about the alignment of structs. This takes the form of assuming
> that structs are only aligned to the alignment of their largest data type.
> Which is broken: the NetBSD code or the compiler?

Both could be considered "correct" and some systems (i.e. SVR4)
deal with this using the following where packing is required:

#pragma pack 
	short a;
	short b;
	short c;
} foo;
#pragma nopack

Of course, then the system needs its own special compiler...

Gordon Ross