[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: _Compare, passes array to single value compare.. Bug?
[Thread Prev] | [Thread Next]
- Subject: Re: _Compare, passes array to single value compare.. Bug?
- From: Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
- Date: Wed, 10 Jul 2024 18:06:45 +0200
- To: user@xxxxxxxxxxxxxxxxxxxxxx
Le 10/07/2024 à 17:29, Brian G a écrit :
When I have an object called myobject with a _compare() the compiler passes both myobject and myobject[] to the function. But does not pass either when both are myobject[]. Not sure what the correct behavior is, but it seems incorrect to pass [] to a single myobject.Anybody know what it should happen, or do we have to guard against receiving an [], what should be the correct return value when we get an [].Sample script -------------------------------------------------------------------------- #!/usr/bin/env gbs3 'Auto Generated Script 07/10/2024 15:15:32.628 Version (3.19.90) #Script Startup="Main" #Script Version="0.0.1" class cmpit ' Gambas class file Public value As Variant = Null Public Sub _new(newvalue As Variant) value = newvalue End Public Sub _compare(rvalue As Variant) As Integer If value = rvalue.value Then Return 0 If value > rvalue.value Then Return 1 Return -1 End End class ' Gambas module file Public Sub Main() Print "Hello world" Dim a As New Cmpit(9) Dim b As New Cmpit(10) Dim c As Variant = a Dim e As New Cmpit[10] For i As Integer = 0 To e.Max e[i] = New Cmpit(9) Next Print Str(a = b), Str(c = a) Print Str(a = e) End _________________________________________________________________-
I don't get what you are talking about. Can you post a real project archive instead of just a script?
-- Benoît Minisini.
Re: _Compare, passes array to single value compare.. Bug? | Brian G <brian@xxxxxxxxxxxxxxxx> |
Re: _Compare, passes array to single value compare.. Bug? | Brian G <brian@xxxxxxxxxxxxxxxx> |
_Compare, passes array to single value compare.. Bug? | Brian G <brian@xxxxxxxxxxxxxxxx> |