Announcement

Collapse
No announcement yet.

Crash in PBDLL

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

  • Crash in PBDLL

    This will crash:
    Just to let you know..
    (Useless code anyway)

    Code:
    #Compile Exe
     
    Function PbMain
     
        MsgBox Str$( Len( "123" ) + Len( "234" ) )
     
    End Function
    And somethimes this too:

    Code:
    #Compile Exe
     
    Function PbMain
     
        Dim T1 As String
        Dim T2 As String
     
    '    T1 = "123"
    '    T2 = "234"
     
        MsgBox Str$( Len( "123" ) + Len( "234" ) )
     
        MsgBox Str$( Len( T1 ) & Len( T2 ) )
     
    End Function
    module WGFWER.EXE op014f:00401981

    Used: W95b

    ------------------
    [email protected]
    hellobasic

  • #2
    IIRC, LEN("literal") seems to be the killer. I think this has been reported before in a slightly different context.

    MCM

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

    Comment


    • #3
      Yes, LEN() currently does not work on a string literal, and this has been discussed a few times before on this BBS.

      Since the length of a literal is known by the programmer (before compilation), it is more efficient to hard-code the length value instead of making a run-time calculation on the hard-coded string literal.

      That said, R&D have told me that LEN() will be made to work with a string literal in the next update to the compiler.

      Thanks!


      ------------------
      Lance
      PowerBASIC Support
      mailto:[email protected][email protected]</A>
      Lance
      mailto:[email protected]

      Comment

      Working...
      X