Strange error

For everything that's not in any way related to PureBasic. General chat etc...
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Strange error

Post 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?
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
Killswitch
Enthusiast
Enthusiast
Posts: 731
Joined: Wed Apr 21, 2004 7:12 pm

Post 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.
~I see one problem with your reasoning: the fact is thats not a chicken~
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Yes, that's strange... That's why I asked, because it seemed a little bit odd, but it's nothing important...
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

I don't think assembler error is ever supposed to happen.
Killswitch
Enthusiast
Enthusiast
Posts: 731
Joined: Wed Apr 21, 2004 7:12 pm

Post by Killswitch »

Oh, it's important...

Fred! FRED!

:D
~I see one problem with your reasoning: the fact is thats not a chicken~
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

on what line did it cause the error?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post 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.
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
Post Reply