Article View: comp.std.c
Article #3618Re: Wishful thinking: return-parameter
From: Tony Bass
Date: Wed, 02 Aug 1995 13:38
Date: Wed, 02 Aug 1995 13:38
27 lines
1787 bytes
1787 bytes
From article <3vnqah$1ev@news.cs.tu-berlin.de>, by mfx@cs.tu-berlin.de (Markus Freericks):
> Most hardware _has_ a clever trick for return values: registers. Most
> compilers use a register to pass the return value up, no?
>
> On the topic of hidden costs: _current_ C has an "invisible overhead", as
> the return value is copied to some unnamed location by the returning
> function, and then read from that location when the calling function uses
> the value. Introducing one or more explicit return parameters would remove
> this "hidden variable"!
Isn't this a question of implementation rather than a language
requirement? I can imagine in theory a compiler passing a hidden
destination address parameter to a routine that had to return a large
struct, and then with careful alias analysis determining that the
address passed could be an actual assignment lhs rather than a
temporary. Or is there some reason why this could not satisfy the
semantics of the standard?
Not that I have ever seen a C compiler actually doing this.
Tony Bass
--
# Tony Bass Tel: (01473) 645305
# MLB 3/19, BT Laboratories e-mail: aeb@saltfarm.bt.co.uk
# Martlesham Heath, Ipswich, Suffolk, IP5 7RE DO NOT e-mail to From: line
# Opinions are my own
Technical Details
Message-ID:
<3vnv5b$jic@lamb.saltfarm.bt.co.uk>Path:
arc1-ca.pugleaf.net!lamb.saltfarm.bt.co.uk!not-for-mailReferences:
<3vnqah$1ev@news.cs.tu-berlin.de>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!lamb.saltfarm.bt.co.uk!not-for-mail From: aeb@lamb.saltfarm.bt.co.uk (Tony Bass) Newsgroups: comp.std.c Subject: Re: Wishful thinking: return-parameter Date: 2 Aug 1995 14:38:51 +0100 Organization: BT Speech Technology Section Message-ID: <3vnv5b$jic@lamb.saltfarm.bt.co.uk> References: <3vnqah$1ev@news.cs.tu-berlin.de> Reply-To: aeb@saltfarm.bt.co.uk NNTP-Posting-Host: lamb.saltfarm.bt.co.uk