Re: sizeof problem in kernel modules

2001-06-25 Thread Horst von Brand
Alan Shutko <[EMAIL PROTECTED]> said: > One more tidbit: ISO/IEC 9899:1990 3.14 > > 3.14 object: A region of data storage in the execution environment, > the contents of which can represent values. Except for > bit-fields, objects are composed of contiguous sequences of one or > mo

Re: sizeof problem in kernel modules

2001-06-25 Thread Andreas Schwab
Alan Shutko <[EMAIL PROTECTED]> writes: |> Alan Shutko <[EMAIL PROTECTED]> writes: |> |> > You can look at other things too... you can memcpy structures, pass |> > them into functions, call sizeof, put them in arrays... it _is_ a |> > physical representation. |> |> One more tidbit: ISO/IEC 9899

RE: sizeof problem in kernel modules

2001-06-24 Thread Anil Kumar
struct { short x; long y; short z; }bad_struct; struct { long y; short x; short z; }good_struct; I would expect both structs to be 8byte in size , or atleast the same size ! but good_struct turns out to be 8bytes and bad_struct 12 . what am I doing wrong here ? thx ! hofrat

Re: sizeof problem in kernel modules

2001-06-24 Thread Michael Meissner
On Sat, Jun 23, 2001 at 10:43:14PM -0400, Richard B. Johnson wrote: > Previous to the "Draft" "Proposal" of C98, there were no such > requirements. And so-called ANSI -C specifically declined to > define any order within structures. As one of the founding members of the X3J11 ANSI committee, and

Re: sizeof problem in kernel modules

2001-06-24 Thread frank
On Sat, 23 Jun 2001, Richard B. Johnson wrote: > On Sun, 24 Jun 2001, Keith Owens wrote: > > > On Sat, 23 Jun 2001 21:56:06 -0400 (EDT), > > "Richard B. Johnson" <[EMAIL PROTECTED]> wrote: > > >FYI, structures are designed to be accessed only by their member-names. > > >Therefore, the compiler

Re: sizeof problem in kernel modules

2001-06-23 Thread Richard B. Johnson
On Sun, 24 Jun 2001, Keith Owens wrote: > On Sat, 23 Jun 2001 21:56:06 -0400 (EDT), > "Richard B. Johnson" <[EMAIL PROTECTED]> wrote: > >FYI, structures are designed to be accessed only by their member-names. > >Therefore, the compiler is free to put members at any offset. In fact, > >members, o

Re: sizeof problem in kernel modules

2001-06-23 Thread Richard B. Johnson
On Sat, 23 Jun 2001, Der Herr Hofrat wrote: > > Hi ! > > can someone explain to me whats happening here ? > > --simple.c-- > #include > #include > > struct { short x; long y; short z; }bad_struct; > struct { long y; short x; short z; }good_struct; > [SNIPPED...] > ---

Re: sizeof problem in kernel modules

2001-06-23 Thread Russell King
On Sat, Jun 23, 2001 at 04:54:20PM +0200, Der Herr Hofrat wrote: > struct { short x; long y; short z; }bad_struct; > struct { long y; short x; short z; }good_struct; > > I would expect both structs to be 8byte in size , or atleast the same size ! > but good_struct turns out to be 8bytes and bad_s