Strict vs. SuperStrict
BlitzMax Forums/BlitzMax Beginners Area/Strict vs. SuperStrict
| ||
I use Strict to "somewhat' enforce good coding style; I see in the documentation there is a command called "SuperStrict" but the documentation has nothing, nada about it .. all it says is "set superstrict mode" ... Not exactly helpful ... |
| ||
Well it does. You should use it. If memory serves, the main difference is that it forces you to declare which type your variable or references is (as opposed to which scope it has). |
| ||
I do use "Strict", and tried changing to SuperStrict and still built everything fine; then again, I always declare everything anyway, so that might be why Superstrict did not flag anything. I am using SuperStrict now, and hope someone can explain the details between strict and superstrict sometime? |
| ||
FlameDuck already explained the difference. Strict forces you to declare variables. SuperStrict forces you to declare variables and specify their type. Try the following four examples : Strict A=1 Strict Local A=1 SuperStrict Local A=1 SuperStrict Local A:Int=1 |
| ||
Not only does it force good nameing and scope practice apon you, but it also makes the compiled code better, (apparantly). And somtimes its not obvious with only strict if you are allocating a Int handle or an object pointer |
| ||
Not only does it force good nameing and scope practice apon you, but it also makes the compiled code better, (apparantly). Yes, Mark mentioned that there are optimizations that could be used because BM no longer has to do as much checking/conversion (or something like that). Personally, I think Mark should change the Superstrict keyword to strict, Alias Superstrict to Strict (for backwards compatibility) and do away with strict mode altogether. |
| ||
God stuff guys; I have superStrict as my very first command at the top of my code. |