l4-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IDL issue - struct return vs. cap return


From: Neal H. Walfield
Subject: Re: IDL issue - struct return vs. cap return
Date: Tue, 10 Jul 2007 17:24:18 +0200
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.4 (i386-pc-linux-gnu) MULE/5.0 (SAKAKI)

Thanks for the nice explanation, it confirms how I thought it
worked.

> Hopefully this explains Neal's confusion about return value rewrites.

Nope.  I don't think I had any confusion about how return values are
returned.  My confusion lies in here:

> At Sun, 08 Jul 2007 00:03:10 -0400, Jonathan S. Shapiro wrote:
> > If we choose to adopt the "return the return value" convention, it is
> > still necessary to handle capability returns specially in C, because the
> > caller must say where the incoming capability is to be stored (we cannot
> > get compiler help for this from an unmodified compiler).
> 
> How is this different from returning a struct?  There is a general
> rule of thumb not to return large structs from function calls.
> Instead, the convention is for either the function allocates memory or
> the caller to pass a pointer to a block of allocated memory.

You appear to me to have implied that return by value is somehow
normal and that return by reference is not.  My observation was that
structs are often returned by reference, not by value.  I claimed that
if you want to generally return structs by value, then there are
scenarios where you also need to modify the compiler--just like when
returning capabilities by value.

Neal





reply via email to

[Prev in Thread] Current Thread [Next in Thread]