On Jan 30, 2011, at 4:07 PM, Jonathan Wakely wrote: > On 30 January 2011 21:02, Amittai Aviram wrote: >> >> I tried it with strncpy and with __builtin_strncpy, with exactly the same results, i.e., the assembly code still calls strncpy with three arguments. > > Did you enable optimization? I hadn't and that did it--even with just "-O1." Thank you! Very interesting!— movl $1280066888, (%rsp) movw $79, 4(%rsp) The first integer in hex is 4C 4C 45 48 ( == 'L','L','E','H') and the second (79) is 4F ( == 'O') So, of course, it works out when assigned in little-endian order. The second assignment also puts NULL in the right place as the higher-order bits of the integer 79. Amittai Aviram PhD Student in Computer Science Yale University 646 483 2639 amittai.aviram@xxxxxxxx http://www.amittai.com