Announcement

Collapse

Maintenance

The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

LEN("123") gives GPF

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

  • LEN("123") gives GPF

    Hi,

    why does the following code gives a GPF:
    Code:
    MSGBOX STR$(LEN("12345"))
    Very strange, i think


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

    mailto:[email protected][email protected]</A> www.selisoft.com

  • #2
    I can reproduce this as well. The following GPF's for me:

    Code:
    #dim all
    #compile exe
    function pbmain
       msgbox str$(len("12345"))
    end function
    putting #register none at the top has no effect.

    interestingly enough, the following does not gpf:

    Code:
    #compile exe
    function pbmain
       Dim sTest as String
       sTest = "something"
       msgbox str$(len("12345"))
    end function
    Finally, replacing str$ with format$ has no effect. format$ gpf's too.

    Best Regards,
    Don


    ------------------
    Don Dickinson
    www.greatwebdivide.com

    Comment


    • #3

      Thats weird, I get a return value of 0 in the MsgBox but no GPF !?!?



      ------------------
      Kev G Peel
      KGP Software, Bridgwater, UK.
      www.go.to/kgpsoftware
      kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

      Comment


      • #4
        It looks that PB forgot to prevent such statements.
        If VarPtr("12345") and StrPtr("12345") are not allowed, why Len("12345") should be allowed ?

        When you simply use $a = "..." the string is stored, if there is no reference to it.
        It looks that here is the "same" case, because

        Code:
           #Compile Exe
           Function PbMain
              Dim sTest As String
              sTest = "12345"
              MsgBox Str$(Len("12345"))
           End Function
        works.


        ------------------
        E-MAIL: [email protected]

        Comment


        • #5
          There's nothing wrong with the statement as such. This is a compiler
          error which will be fixed in the next update.

          ------------------
          Tom Hanlin
          PowerBASIC Staff

          Comment

          Working...
          X