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: buffer2.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!newspeer1.nac.net!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 00:27:54 +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 00:27:54 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="35d9ff4bae8e9ef2b03accb636bca86d"; logging-data="5389"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX193tgfL7Za15ZdNDQnZEa1N44TfJmLHaEk=" User-Agent: slrn/0.9.9p1 (Linux) Cancel-Lock: sha1:4JaZHoU6qfnOzgujseSgjxaUD+o= Xref: number.nntp.dca.giganews.com comp.lang.ada:189245 Date: 2014-09-30T00:27:54+00:00 List-Id: On 2014-09-29, Georg Bauhaus wrote: > On 29.09.14 21:37, Simon Clubley wrote: >> void update_value(unsigned long int a) >> { >> printf("Value of a on entry to update_value() is %lu\n", a); >> a = a + 7; > > Once you submit to contradictions like "a equals a + 7" being signs > of advanced understanding---though wondering how that could be--- > you are well prepared for an introduction to more programming quizzes, > such as why and when `5' may become a name of 4. The only time I've ever done anything like that was back in my student days with an old (even at the time) Fortran IV compiler which passed everything, including integer constants, by reference and the constants were shared between program statements in a literal pool. There was also no read-only memory protection within a process on this miniframe. One day I passed an integer constant (4, IIRC) into a subroutine. I'll let you work out what happened next. However, it taught me one hell of a lesson which I've never forgotten. :-) To return to the issue at hand, I posted the example without comment instead of the rant about the "wonders" of C I was feeling while creating it. 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... Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world