
10 Dec
2008
10 Dec
'08
11:58 p.m.
On 11 Dec 2008, at 5:17 am, Mauricio wrote:
This would solve half my problem. Can I always trust that? I've been told before that everytime a C function returns a struct it is actually returning a pointer, but I wasn't able to find that written in stone
That's because it isn't true. In fact one of the classical ways for a C function to return a struct is to be *GIVEN* a pointer, e.g., struct Foo f(......) { ... return x; } => void f(struct Foo *_hidden, ......) { ... *_hidden = x; return; } and obviously a C compiler is entitled to return a small struct in registers if it feels like it.