Undocumented Errors

Started by Mikey, November 27, 2018, 19:50:15

Previous topic - Next topic

Mikey

Is there some unknown error embedded within the PRINT command?
I'm using it in some code and the statement:

FIW=200:Print FIW/FW:Print FIW:Print FW:WaitKey:End

does not work in this section of the source:

GHEI=900:GWID=1600:Graphics GWID,GHEI,16,2;:Dim T$(10000):;Global
LPS=GHEI/FontHeight();WaitKey:End
FW=FontWidth():FH=FontHeight():Print "GF":Print OLO:Print CR$:R$=CR$
FIW=200:Print FIW/FW:Print FIW:Print FW:WaitKey:End
Type AFS Field NUM$ End Type:Type AFN Field CDNUM$ End Type
FH1=ReadFile("KJV.TXT"):NF=0:FN$="W:\MSFX":
;===
While Not Eof(FH1) O$=ReadLine(FH1):LO=Len(O$)
If LO>OLO
OLO=LO:CR$=O$
EndIf
Wend


Is there something I'm missing or am I stupid?

RemiD

#1
after a quick look :

GWID% = 640 : GHEI% = 480
Graphics GWID,GHEI,16,2
;XFont = LoadFont("Arial",16,False,False,False)
;SetFont(XFont)
FWID% = FontWidth() : FHEI% = FontHeight() : DebugLog(FWID+","+FHEI)
LPS%=GHEI/FHEI : DebugLog(LPS)
Print "GF"
Print OLO ; OLO ???
Print CR$ ; CR ???
R$=CR$

FIW=200
Print FIW/FW ; FW ???
Print FIW
Print FW

Type AFS
Field NUM$
End Type

Type AFN
Field CDNUM$
End Type

FH1=ReadFile("KJV.TXT")
NF=0:
FN$="W:\MSFX":

While Not Eof(FH1)
O$=ReadLine(FH1)
If( O <> "" )
  LO=Len(O$)
  If LO > OLO ;OLO ???
   OLO=LO
   CR$=O$
  EndIf
EndIf
Wend

End()

col

#2
Hiya,

Looks like a divide by zero (FW isn't defined in your example) causing a hang (unhandled exception) - more specifically Blitz3D show be handling the exception instead of waiting for the OS to handle it.

If you're building from the VS2017 source then the problem can be fixed by correctly setting the c++ exception handling -

  • Right-click the 'bbruntime' project from the Solution Explorer and select properties to bring up the build configuration property window.
  • In the left tree-view of that property window open the tree-view to 'Configuration Properties->C/C++->Code Generation'.
  • In the right window set the 'Enable C++ Exceptions' option to 'Yes with SEH Exceptions (/EHa)'.
  • Click 'Apply', then 'OK' to close that property window.
  • Rebuild the 'bbruntime' project by right-clicking it from the Solution Explorer again and choosing 'Rebuild Project', or alternatively rebuild the whole solution
The pic below shows the property settings window...
https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."