Compilation with gcc 4.6.0

Nix nix at esperi.org.uk
Sat Jun 18 21:19:33 UTC 2011


On 12 Jun 2011, Russ Allbery spake thusly:

> Julien ÉLIE <julien at trigofacile.com> writes:
>
>> In authprogs/radius.c:
>
>> static void req_copyto (auth_req to, sending_t *from)
>> {
>>     to = from->req;
>> }
>
>> The function is called in the code with:
>>     req_copyto(req, sreq);
>
>> gcc tells me the function does nothing ("to" is unused).  I understand
>> that we should give &req as the first argument and take the *to pointer.
[...]
> Oh, weird.  I wonder if we're taking advantage of compiler-specific
> behavior in passing structs by value instead of by reference.

Not hardly, it's been in the C Standard forever. (IIRC vendors started
adding it to C in something like 1978.)

-- 
NULL && (void)



More information about the inn-workers mailing list