Messages in this thread | | | Subject | Re: p = kmalloc(sizeof(*p), ) | From | Miles Bader <> | Date | Wed, 21 Sep 2005 11:18:27 +0900 |
| |
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/
| |