comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP>
Subject: Re: actual for variable name must be variable compiler error
Date: Mon, 29 Sep 2014 19:37:40 +0000 (UTC)
Date: 2014-09-29T19:37:40+00:00	[thread overview]
Message-ID: <m0cce3$g1o$1@dont-email.me> (raw)
In-Reply-To: EFaWv.193306$zG.142949@fx17.fr7

On 2014-09-29, Brian Drummond <brian3@shapes.demon.co.uk> 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 <stdio.h>

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


  reply	other threads:[~2014-09-29 19:37 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 [this message]
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
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