lkml.org 
[lkml]   [2001]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: sizeof problem in kernel modules
Date
On Sat, 23 Jun 2001 21:56:06 -0400 (EDT), 
"Richard B. Johnson" <root@chaos.analogic.com> 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, other than the first, don't even have to be in the order
>written!

Bzzt! I don't know where people get these ideas from. Extracts from
the C9X draft.

A structure type describes a sequentially allocated nonempty set of
member objects (and, in certain circumstances, an incomplete array),
each of which has an optionally specified name and possibly distinct
type.

When two pointers are compared ... If the objects pointed to are
members of the same aggregate object, pointers to structure members
declared later compare greater than pointers to members declared
earlier in the structure.

Two objects may be adjacent in memory because they are adjacent
elements of a larger array or adjacent members of a structure with no
padding between them,

As discussed in 6.2.5, a structure is a type consisting of a sequence
of members, whose storage is allocated in an ordered sequence,

Within a structure object, the non-bit-field members and the units
in which bit-fields reside have addresses that increase in the order
in which they are declared

C requires that members of a structure be defined in ascending address
order as specified by the programmer. The compiler may not reorder
structure fields, although bitfields are a special case.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:55    [W:0.195 / U:2.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site