From: Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP>
Subject: Re: actual for variable name must be variable compiler error
Date: Tue, 30 Sep 2014 19:48:55 +0000 (UTC)
Date: 2014-09-30T19:48:55+00:00 [thread overview]
Message-ID: <m0f1f7$hi1$1@dont-email.me> (raw)
In-Reply-To: p4bl2a1hsjg5ab3j3fceu61asuttrsfdub@4ax.com
On 2014-09-30, Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote:
> On Tue, 30 Sep 2014 00:27:54 +0000 (UTC), Simon Clubley
><clubley@remove_me.eisner.decus.org-Earth.UFP> declaimed the following:
>
>>However, I want to make it clear I don't write production code like
>>that. If an in parameter needs modifying in a C program it gets copied
>>into a local variable and worked on there. Modifying an in parameter
>>in the way it's done in my example just feels so very wrong to me even
>>when the language lets you do it...
>>
> The main concept is that the parameter, in C, is effectively already a
> local copy... Changes don't propagate back out (unless one has explicitly
> declared it a pointer type and is doing dereferencing on the pointer; or a
> C++ reference parameter).
>
Yes, I know, but visually it looks really weird in the code especially
when you use other languages such as Ada in which such a parameter is
immutable or other languages in which such a change would be pushed
back to the caller (and trigger a trying to change a literal type error
in this case).
Adam also makes a really good point and there's a good element of that
potential for confusion in the code in my objections as well.
Simon.
--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world
next prev parent reply other threads:[~2014-09-30 19:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-29 0:48 actual for variable name must be variable compiler error Stribor40
2014-09-29 2:50 ` Jeffrey Carter
2014-09-29 10:39 ` Brian Drummond
2014-09-29 19:37 ` Simon Clubley
2014-09-29 21:33 ` Georg Bauhaus
2014-09-30 0:27 ` Simon Clubley
2014-09-30 12:09 ` Peter Chapin
2014-09-30 13:17 ` Dennis Lee Bieber
2014-09-30 19:48 ` Simon Clubley [this message]
2014-09-30 14:47 ` Adam Beneschan
2014-09-29 14:27 ` Denis McMahon
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox