You are not logged in.

theuserbl

Intermediate

  • "theuserbl" started this thread

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

1

Saturday, November 8th 2014, 2:05pm

Compiler-bug: handling of overloaded functions

There existing a compiler-bug with the handling of overloaded functions:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Public Sub Nums(val1 As Integer, val2 As Integer)
  Console.Print "Integers called"
End Sub

Public Sub Nums(val1 As Single, val2 As Single)
  Console.Print "Singles called"
End Sub

Public Sub Command1_Click()
   Nums(3,7)
End Sub

Public Sub Command2_Click()
   Nums(4,8.5)
End Sub

Public Sub Command3_Click()
   Nums(6.3,2)
End Sub

Public Sub Command4_Click()
   Nums(7.4,5.7)
End Sub

If one number is Integer and the other is Single, then in this case - where no subroutine with one Integer and one Single argument exists - the subroutine with the two Single vales have to be called. But Jabaco calles everytime the Integer-sub. Only if both are Single, then it calles the Single sub.
But as I says: Correct would be the other way around: Everytime calling the Single-sub, only if both are Integer, then the Integer-sub should be called.

Greatings
theuserbl

Rate this thread
WoltLab Burning Board