Testing and debugging a source code is far more common than creating a final executible.
As far as I know, this compiler-option does nothing other, than it makes the constant #PB_Editor_CreateExecutable disposable for the compiler. There is no executable created or not, if this constant is set or not.
I apologize, I misunderstood your question when I first read it and thought it was simply about the need to having a 'create executable' menu option.
Returning to your actual question, wouldn't the #PB_Editor_CreateExecutable constant be useful to allow a program to create code for test data or make logging options active if the program is not the final executable?
Perhaps something like this:
;If code is compiled without using the compiler option that creates
;the #PB_Editor_CreateExecutable constant it will set up code for
;logging data to either a file or the debugger window (based on the
;value of #UseDebugForLoggingFunctions).
;If the #PB_Editor_CreateExecutable constant is activated in the
;compiler options it will not include code for the logging
;functions and make them non-existent for the resulting executable.
CompilerIf Not Defined(PB_Editor_CreateExecutable, #PB_Constant)
#PB_Editor_CreateExecutable = #False ;If not defined in compiler options or otherwise, set it to #False
CompilerIf #PB_Editor_CreateExecutable = 1
;don't create logging code if this is an executable, create do-nothing substitutes instead
Macro logToFile(fileID, text)
#UseDebugForLoggingFunctions = #True ; set to #False to use file output, #True = debugger output window
;create logging functions
a = -1
a = OpenFile(#PB_Any, filename)
If Not a
MessageRequester("Error", "Couldn't create log file.")
Procedure logToFile(fileID, text.s)
If fileID = -1
Debug Str(fileID) + ": " + text.s
Define fileID = createLogFile("J:\filename.log") ;0 = function not available
For i = 1 To 10
logToFile(fileID, "Line #" + i)
;some processing functions
If code is compiled without using the compiler option that creates the #PB_Editor_CreateExecutable constant it will set up code for logging data to either a file or the debugger window (based on the value of #UseDebugForLoggingFunctions).
If the #PB_Editor_CreateExecutable constant is activated in the compiler options it will not include code for the logging functions and make them non-existent for the resulting executable.
In any case there are 3 distinct compiling choices: one for debugging, one for testing and one for the final executable. This constant helps distinguish between the two that are not debugging options.
I agree that it may be better to simply replace it with a compiling constant that is always available. It should only depend on if it is possible to always know if something is a final executable or not when it is being compiled.