From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Clubley Newsgroups: comp.lang.ada Subject: Re: actual for variable name must be variable compiler error Date: Tue, 30 Sep 2014 19:48:55 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Date: Tue, 30 Sep 2014 19:48:55 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="e051aad4a8e5df63d18daa07cdb85400"; logging-data="17985"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/eZVyXOJxfBL09claJLg9kk1hPFZHyNEc=" User-Agent: slrn/0.9.9p1 (Linux) Cancel-Lock: sha1:ziS7bCW01MZ0JKY+RhOcqlUzfuk= Xref: number.nntp.dca.giganews.com comp.lang.ada:189257 Date: 2014-09-30T19:48:55+00:00 List-Id: On 2014-09-30, Dennis Lee Bieber wrote: > On Tue, 30 Sep 2014 00:27:54 +0000 (UTC), Simon Clubley > 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