Page 1 of 1

Strange error

Posted: Sun Jun 18, 2006 9:18 pm
by Inf0Byt3
I was working on a procedure set and made a typo, I put = instead of - and the compiler didn't raised an error (the assembler did). Here's the code:

Code: Select all

Procedure GetDriveType(Parameter.s)
 Select GetDriveType_(Parameter)
  Case 2
   Result = 2;"Floppy"
  Case 3
   Result = 3;"Drive Fixed"
  Case 4
   Result = 4;"Remote"
  Case 5
   Result = 5;"Removable"
  Case 6
   Result = 6;"Ram disk"
  Default
   Result = 7;"Unknown"
 EndSelect
 ProcedureReturn Result
EndProcedure

Procedure FindDrives()
  *DriveBuffer = AllocateMemory(255)
  For i = 0 To GetLogicalDriveStrings_(255, *DriveBuffer)
   DriveL = PeekB(*DriveBuffer + i)
   Drives.s = Drives.s + Chr(DriveL)
  Next
  Debug Drives.s
  Slash = CountString(Drives,"\",1)
  For Divide = 1 To Slash=1
   DriveLetter.s = StringField(Drives,Divide,"\")+"\"
   If DriveLetter <> ""
    AddElement(Drives())
    Drives() = DriveLetter
    Debug DriveLetter
   EndIf
  Next Divide
  ResetList(Drives())
  ProcedureReturn
EndProcedure
Is this a bug in PB or it's just me? Shouldn't the compiler warn before calling FASM?

Posted: Sun Jun 18, 2006 9:36 pm
by Killswitch
Well, if PB takes 'Slash=1' as an expression (like If Slash=1) then that could be why it doesn't raise an error. That doesn't sound like normal PB behaviour to me, though.

Posted: Sun Jun 18, 2006 9:51 pm
by Inf0Byt3
Yes, that's strange... That's why I asked, because it seemed a little bit odd, but it's nothing important...

Posted: Sun Jun 18, 2006 10:06 pm
by Trond
I don't think assembler error is ever supposed to happen.

Posted: Sun Jun 18, 2006 10:09 pm
by Killswitch
Oh, it's important...

Fred! FRED!

:D

Posted: Mon Jun 19, 2006 2:11 pm
by blueznl
on what line did it cause the error?

Posted: Mon Jun 19, 2006 4:16 pm
by Inf0Byt3
This one:

Code: Select all

For Divide = 1 To Slash=1 
But this is not all the code (the whole file was ~75 kb long)... However, the threadsafe option was on, if this helps. Hope it's nothing that can't be fixed :D.