Announcement

Collapse
No announcement yet.

PBDLL: Geting strange results in a sub

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PBDLL: Geting strange results in a sub

    Hi All

    When testing this code, the msgbox display an astronomical no.
    Can sombody verify it.

    SUB Test(c AS CUR)
    MSGBOX STR$(c)
    END SUB

    FUNCTION PBMAIN() AS LONG
    LOCAL a AS CUR
    LOCAL b AS CUR

    a = 1
    b = 2
    Test a + b
    END FUNCTION

    With my PbDll compiler, The MsgBox Display 1803464498531.54



    ------------------

  • #2
    I got 180330300776.12.

    ------------------

    Comment


    • #3
      If you add BYVAL to the sub, like: SUB Test(BYVAL c AS CUR)
      if works fine.


      ------------------

      Comment


      • #4
        Since the sub is not external sub, the compiler should determine
        the parameters passing convention.

        And Indeed if you change the vars type from CUR to LONG or DOUBLE
        the sub will work fine, it's only happening with the CUR vars.


        ------------------


        [This message has been edited by Gafny Jacob (edited July 11, 2000).]

        Comment


        • #5
          CUR and CUX. Yes, you are right, Gafny. Interesting observation -
          seems like a job for the PB dev. team there..


          ------------------

          Comment


          • #6
            Instead of changing the declaration, you can set up a local variable and it works:

            Code:
              LOCAL A AS CUR, B AS CUR, C AS CUR
              A=1: B=2: C= A + B
              TEST C
            MCM


            ------------------
            Michael Mattias
            Racine WI USA
            [email protected]
            Michael Mattias
            Tal Systems Inc. (retired)
            Racine WI USA
            [email protected]
            http://www.talsystems.com

            Comment

            Working...
            X