[Info-vax] VMS Basic and quad by value

Arne Vajhøj arne at vajhoej.dk
Sat Sep 24 18:57:42 EDT 2022


On 9/23/2022 9:09 PM, Dave Froble wrote:
> On 9/23/2022 6:45 PM, Arne Vajhøj wrote:
>> On 9/23/2022 4:45 PM, Bill Gunshannon wrote:
>>> On 9/23/22 16:37, Arne Vajhøj wrote:
>>>> I am not good at Basic so I may be missing something obvious.
>>>>
>>>> As I read the manual then I should be able to pass a quad by value.
>>>>
>>>> But the compiler disagrees.
>>>>
>>>> Can anybody shed some light on this?
>>>>
>>>
>>> Can you show us the code?
>>
>> Sure.
>>
>> $ type z1.bas
>> program z1
>>
>> declare quad v
>>
>> v = 123
>> call f(v)
> 
> You do realize, I hope, that you are passing the variable by reference?

No. I don't.

:-)

>> end program
>> !
>>
>> sub f(quad a by value)
> 
> I tried this.  It appears that Basic does not allow an argument to be 
> declared QUAD and received By Value.  I'd consider this a bug.

Given that the docs claims it should work, then it must
be a bug.

And I believe the compiler should be fixed not the documentation,
because on Alpha, Itanium and x86-64 there is no reason not to
allow it.


> However, to demonstrate:
> 
> AS800> t z5.bas,z6.bas
> 1       ! Program Z5
> 
>          Declare Quad Q
> 
>          Q = 123
>          Call Z6( Q )
>          Print Q
> 
> End
> 
> SYS$SYSDEVICE:[DFE]Z6.BAS;4
> 
> 1       ! Program Z6
> 
>          Sub Z6( Long L By Value )
> 
>          Print L
> 
>          End Sub
> AS800> run z5
>   2061851336
>   123
> AS800>
> 
> As expected, the value of the argument is the address of the quadword 
> variable in program Z5.

Two compilation units. I only had one.

It seems to work with long.

$ typ z2.bas
program z2

declare quad v

v = 123
call f(v)

end program
!

sub f(quad a)

     print a

end sub
$ bas z2
$ lin z2
$ r z2
  123

Apparently the Basic compiler do look ahead in the compilation unit.

Arne







More information about the Info-vax mailing list