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: Xl.tags.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 30 Sep 2014 07:09:20 -0500 Date: Tue, 30 Sep 2014 08:09:19 -0400 From: Peter Chapin User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: actual for variable name must be variable compiler error References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Message-ID: X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-ABehqpJ8+iVeeJGvrN0HIim7jpw5ysSXn+LfdBCy0ouum2R4iW3ketxEnth8aoWJEkki1fzRqwybJmv!uu0fjfvUIye5ymNYPw69tc7g/BB7dTttsmBi2GuJP+yoVnXpFv9VnsF+QJgdZwbSeB9O9Hiez+o= X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2136 Xref: number.nntp.dca.giganews.com comp.lang.ada:189251 Date: 2014-09-30T08:09:19-04:00 List-Id: On 2014-09-29 20:27, Simon Clubley wrote: > 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... In C parameters have the same status as local variables. If it is convenient to modify it, then I modify it just as I might modify a local. If it is not something to be modified one can declare it const as with any local void f(const int x) { x = 5; // Error. Modifying a const. } I use a tool (PC-Lint) that can be configured to remind me whenever a parameter could be declared const. I generally try to follow its advice in this area. Peter