lkml.org 
[lkml]   [2004]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: drivers/block/ub.c
On Mon, 28 Jun 2004 22:57:11 +0200
Oliver Neukum <oliver@neukum.org> wrote:

> Am Montag, 28. Juni 2004 22:25 schrieb David S. Miller:
> > That's true.  But if one were to propose such a feature to the gcc
> > guys, I know the first question they would ask.  "If no padding of
> > the structure is needed, why are you specifying this new
> > __nopadding__ attribute?"
>
> It would replace some uses of __packed__, where the first element
> is aligned.

You have not considered what is supposed to happen when this
structure is embedded within another one. What kind of alignment
rules apply in that case? For example:

struct foo {
u32 x;
u8 y;
u16 z;
} __attribute__((__packed__));

struct bar {
u8 a;
struct foo b;
};

That is why __packed__ can't assume the alignment of any structure
instance whatsoever. Your __nopadding__ attribute proposal would
lay out struct bar differently in order to meet the alignment guarentees
you say it will be able to meet.
-
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 14:04    [W:0.351 / U:0.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site