lkml.org 
[lkml]   [2005]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: p = kmalloc(sizeof(*p), )
From
Date
Linus Torvalds <torvalds@osdl.org> writes:
> Actually, some day that migth be a good idea, but at least historically,
> gcc has really really messed that kind of code up.
>
> Last I looked, depending on what the initializer was, gcc would create a
> temporary struct on the stack first, and then do a "memcpy()" of the
> result.

A little test shows:

gcc-3.4.4 seems to still do what you describe.

gcc-4.0.1 seems to it the "right" way (writing each field directly to
the destination structure).

Someday...

-miles
--
Yo mama's so fat when she gets on an elevator it HAS to go down.
-
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-09-21 04:21    [W:0.154 / U:0.928 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site