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!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: Mon, 29 Sep 2014 19:37:40 +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: Mon, 29 Sep 2014 19:37:40 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="dfe9ee3dc7e838d870985d28b6346b6d"; logging-data="16440"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/MusWmAsznbTc7N1A0sTuKhCDlkSRFpas=" User-Agent: slrn/0.9.9p1 (Linux) Cancel-Lock: sha1:+XHjIM37ba9J/qmzMvDrb2jJVSE= Xref: number.nntp.dca.giganews.com comp.lang.ada:189243 Date: 2014-09-29T19:37:40+00:00 List-Id: On 2014-09-29, Brian Drummond wrote: > On Sun, 28 Sep 2014 17:48:20 -0700, Stribor40 wrote: > >> procedure myFunction (a: in out INTEGER) is >> begin > a := 4; >> end; > >> myFunction(5) this gives me error that actual must be variable > > is equivalent to > > 5 := 4; > > Not bloody likely! > > - Brian The problem may be that in C it's possible to write the following: #include void update_value(unsigned long int a); int main(int argc, char *argv[]) { update_value(4); update_value(6); return(0); } void update_value(unsigned long int a) { printf("Value of a on entry to update_value() is %lu\n", a); a = a + 7; printf("Value of a after modification is %lu\n", a); return; } which when compiled and run gives: [simon@[deleted] ~]$ gcc -Wall -Werror -o ro_update ro_update.c [simon@[deleted] ~]$ ./ro_update Value of a on entry to update_value() is 4 Value of a after modification is 11 Value of a on entry to update_value() is 6 Value of a after modification is 13 [simon@[deleted] ~]$ Notice how you can modify (at least locally) what in Ada would be an in parameter and it doesn't matter if an integer constant was passed as was done in this case. The OP may be getting confused and thinking you can do the same with integer constants in Ada. Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world