Page 1 of 1
Make the "Create threadsafe executable" enabled by default
Posted: Thu Jun 06, 2013 8:34 pm
by codeprof
I think for beginners speed is not so much important. It is much more important that the application runs correctly.
E.g. If somebody just tests the sample code for "CreateMutex()" it will crash directly.
Also I do not think this breaks to much existing code... (existing code would also only be affected if it is copied newly into the editor)
Otherwise there should be at least a hint in the comment at the beginning of the sample code.
Re: Make the "Create threadsafe executable" enabled by defau
Posted: Thu Jun 06, 2013 8:53 pm
by luis
I think the default settings should be the most light ones and every "addition" should be explicitly selected.
No debugger, no thread safe, no unicode, no purifier, etc., you can set the defaults you like more in compiler option.
New users can learn reading the helpfile like I did when I started or make obnoxious questions here in the forum
If a demo in the help file really need the thread safe option I think it would be better to add this to the code:
Code: Select all
CompilerIf (#PB_Compiler_Thread = 0)
CompilerError "Please enable THREADSAFE in the compiler options"
CompilerEndIf
The delicate equilibrium of the new user is protected and we are all happy.
Re: Make the "Create threadsafe executable" enabled by defau
Posted: Thu Jun 06, 2013 10:53 pm
by MachineCode
As I requested once before, the compiler should just enable thread safety if "CreateThread()" is used in the source, and disable it if not. Smart compiling.
Re: Make the "Create threadsafe executable" enabled by defau
Posted: Thu Jun 06, 2013 11:23 pm
by Demivec
MachineCode wrote:As I requested once before, the compiler should just enable thread safety if "CreateThread()" is used in the source, and disable it if not. Smart compiling.
Smart compiling requires more than one pass for the compiler since the mode of compiling has to be known before it is started.
You do not necessarily need or require thread safety when using CreateThread(). It is true that it is needed in many or most situations but it isn't needed for all of them.
I agree with luis that it is an option that should require selection.
I would be in favor of a way to set compiling options at the top of the code though (i.e. Compile_ThreadSafe, Compile_ASCII, Compile_Unicode, etc.). This would allow placing these options in code without having to put multiple checks with CompilerIf to see if the needed settings are in place. Even so, this would still require a standard set of options when nothing is specified; that's what we already have.

Re: Make the "Create threadsafe executable" enabled by defau
Posted: Thu Jun 06, 2013 11:31 pm
by skywalk
+1 to enable compiler functions in the code.
Then I can drop the comments telling me what to enable and the checks if I didn't.
