Article View: comp.std.c
Article #3595Re: Wishful thinking: return-parameter
From: Peter Seebach
Date: Tue, 01 Aug 1995 12:22
Date: Tue, 01 Aug 1995 12:22
32 lines
1527 bytes
1527 bytes
In article <3vkvmm$rtt@news.cs.tu-berlin.de>,
Markus Freericks <mfx@cs.tu-berlin.de> wrote:
>Two words:
> side effects
>- what if you _want_ one or all results to be undefined?
Give a real-world example, and I'll worry about it.
>- maybe you _want_ to store the result before doing a side effect without
> having to resort to an auxiliary variable, as in
Yes, but at this point, you're assuming the hardware has some clever trick
for return values. Or you're invoking "invisible overhead", which is
against the spirit of C.
> (int ret) get-locked-int () {
> lock();
> ret = thingie;
> unlock();
> return;
> }
Propose a way of doing this without a hidden automatic variable that will
work on all hardware.
-s
--
Peter Seebach - seebs@solon.com || seebs@intran.xerox.com --- C/Unix
proto-wizard -- C/Unix questions? Send mail for help. No, really!
Copyright 1995 Peter Seebach. Not for distribution through Microsoft Network.
a^n+b^n=c^n has integer solutions a, b, and c only for n=2. To prove, assume
Technical Details
Message-ID:
<3vl6b2$dne@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<3ver2u$8bk@caip.rutgers.edu> <3viv5u$bkv@news.cs.tu-berlin.de> <3vjlmk$8co@caip.rutgers.edu> <3vkvmm$rtt@news.cs.tu-berlin.de>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: seebs@solutions.solon.com (Peter Seebach) Newsgroups: comp.std.c Subject: Re: Wishful thinking: return-parameter Date: 1 Aug 1995 07:22:58 -0500 Organization: Usenet Fact Police (Undercover) Message-ID: <3vl6b2$dne@solutions.solon.com> References: <3ver2u$8bk@caip.rutgers.edu> <3viv5u$bkv@news.cs.tu-berlin.de> <3vjlmk$8co@caip.rutgers.edu> <3vkvmm$rtt@news.cs.tu-berlin.de> NNTP-Posting-Host: solutions.solon.com