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.
Make the "Create threadsafe executable" enabled by default
Re: Make the "Create threadsafe executable" enabled by defau
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:
The delicate equilibrium of the new user is protected and we are all happy.
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
"Have you tried turning it off and on again ?"
A little PureBasic review
A little PureBasic review
-
- Addict
- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Re: Make the "Create threadsafe executable" enabled by defau
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.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!
Re: Make the "Create threadsafe executable" enabled by defau
Smart compiling requires more than one pass for the compiler since the mode of compiling has to be known before it is started.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.
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
+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.
Then I can drop the comments telling me what to enable and the checks if I didn't.

The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum