bcc
bcc copied to clipboard
DebugLog() not ignored in release builds
When compiling code containing this here:
SuperStrict
Framework Brl.StandardIO
Type TTest
Field name:String
End Type
Local t:TTest = Null
DebugLog("name: " + t.name) '<-- t.*** is a null access
You will catch it properly in debug builds - in release builds it will simply segfault
Function DebugLog( message$ )
--
Description | Write a string to debug log
Information | If there is no debugger present, this command is ignored.
is a bit ... unclear here. it states "is ignored" which is ... kinda correct as in release builds the debuglog function just becomes an empty stub. Yet the passed parameter is evaluated before -- so not ignored.
I am aware that one could also write
Local t:TTest = Null
Local s:String = "name: " + t.name
DebugLog(s)
but this is not the same then. I assumed using debuglog
is similar to
?debug
print("name: " + t.name)
?
yet it is not similar - but you should write it that way:
?debug
debuglog("name: " + t.name)
?
So ... I wondered if it had side-effects if we simply do not "emit" converted "debuglog"-portions in release builds ?