I thought strict was for suckers, then I started to mispell variable names and searching for them everywhere, so I think I'll go strict ;-)
do you use strict?
BlitzMax Forums/BlitzMax Programming/do you use strict? I use it on everything.
Edit: Correction. Everything but tests to see if I'm doing something that works before I go ahead and write an OO-ified implementation of the idea.
Edit: Correction. Everything but tests to see if I'm doing something that works before I go ahead and write an OO-ified implementation of the idea.
Same here, but sometimes i dont.
i use it all the time.
I use it all the time as BMs behavior is different without strict (variable scopes etc)
Unless i'm using labels and gotos, yes Strict is useful.
What Dre said.
I use it all the time.
I use it almost all the time. It's very handy.
Yeah, I always use Strict. Saves so many problems.
Muttley
Muttley
I use it all the time, and I think it should be by default. I would preffer a RELAXED keyword (for lazy programmers or very small programs), than a STRICT keyword for BMX file. :)
always, my personnal opinion is that not using it is for suckers. Much better to have the compiler tell me I'm a bad typist rather then having to find a logic error.
What's the point of a RELAXED or LAZY command if you have to type it =)
After I get the program at finished stage I go Strict. It's suprising how many loose ends turn up.
Are you guys using Framework as well?
Are you guys using Framework as well?
No, as I'd save writing up the code to use Framework until I was done writing the application and felt nothing else had to be done. So basically, I'd only use Framework for the RC.
What's the point of a RELAXED or LAZY command if you have to type it =)
Everyone looked at me when I laughed out loud in the computer lab.
BTW, do you use globals? Sice I got object orientation, I decided NOT to use globals at all
globals can be used within types as well (then they are quite the same as static in C++) :)
Here's a handy use of globals:
Rem Cower General Public License This license is based off of the zlib/libpng license, I do not take credit for the creation of it as such. This software is 'as-is', without any express or implied warranty. In no event will the author(s) be held liable for damages arising from the use of this software. You are granted to use this software for any purpose, including commercial applications of the software, and to alter, redistribute, and copy it freely, subject to the following terms: 1. You are not to misrepresent the origin of the software; you must not claim that you created the original software. If you use this software, an acknowledgement in the product documentation (or elsewhere) would be appreciated, but it is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. 4. Any modifications made to the source code must be made freely available upon request and under the Cower General Public License. 5. Usage of the software and license can be terminated at any time by the author of the software. If you disagree with any of the terms of the license, you are not permitted to use the software and should delete it immediately. EndRem Strict Import Pub.OpenGL Import Pub.Glew Private Global __glob_glHelp:Byte = 0 Public ' GL Helper Globals Type GLHelper ' Strings Global Ext$ Global Vendor$ Global Renderer$ Global Version$ ' ARB Extensions Global ARB_Mulitexture Global ARB_Texture_Env_Add Global ARB_Texture_Env_Combine Global ARB_Texture_Env_Crossbar Global ARB_Texture_Env_Combine4 Global ARB_Texture_Env_Dot3 Global ARB_Texture_Cube_Map Global ARB_Texture_Border_Clamp Global ARB_Texture_Mirrored_Repeat Global ARB_Texture_Compression Global ARB_Vertex_Blend Global ARB_Depth_Texture Global ARB_Shadow Global ARB_Shadow_Ambient Global ARB_Point_Parameters Global ARB_Transpose_Matrix Global ARB_Vertex_Program Global ARB_Fragment_Program Global ARB_Vertex_Buffer_Object ' Get returns Global MaxTextureUnits Global MaxTextureSize Global MaxAttribStackDepth Global MaxClientAttribStackDepth Global MaxClipPlanes Global Max3DTextureSize Global MaxCubeMapTextureSize Global MaxLights Global MaxModelViewStackDepth Global MaxProjectionStackDepth Global MaxTextureLODBias Global MaxTextureStackDepth Method New() If __glob_glHelp = 0 Then Ext = String.FromCString( glGetString( GL_EXTENSIONS ) ) Vendor = String.FromCString( glGetString( GL_VENDOR ) ) Renderer = String.FromCString( glGetString( GL_RENDERER ) ) Version = String.FromCString( glGetString( GL_VERSION ) ) ARB_Vertex_Buffer_Object = Ext.Find( "GL_ARB_vertex_buffer_object" )>-1 ARB_Fragment_Program = Ext.Find( "GL_ARB_fragment_program" )>-1 ARB_Vertex_Program = Ext.Find( "GL_ARB_vertex_program" )>-1 ARB_Transpose_Matrix = Ext.Find( "GL_ARB_transpose_matrix" )>-1 ARB_Point_Parameters = Ext.Find( "GL_ARB_point_parameters" )>-1 ARB_Shadow_Ambient = Ext.Find( "GL_ARB_shadow_ambient" )>-1 ARB_Shadow = Ext.Find( "GL_ARB_shadow" )>-1 ARB_Depth_Texture = Ext.Find( "GL_ARB_depth_texture" )>-1 ARB_Vertex_Blend = Ext.Find( "GL_ARB_vertex_blend" )>-1 ARB_Texture_Compression = Ext.Find( "GL_ARB_texture_compression" )>-1 ARB_Mulitexture = Ext.Find( "GL_ARB_multitexture" )>-1 ARB_Texture_Env_Add = Ext.Find( "GL_ARB_texture_env_add" )>-1 ARB_Texture_Env_Combine = Ext.Find( "GL_ARB_texture_env_combine" )>-1 ARB_Texture_Env_Crossbar = Ext.Find( "GL_ARB_texture_env_crossbar" )>-1 ARB_Texture_Env_Combine4 = Ext.Find( "GL_ARB_texture_env_combine4" )>-1 ARB_Texture_Env_Dot3 = Ext.Find( "GL_ARB_texture_env_dot3" )>-1 ARB_Texture_Cube_Map = Ext.Find( "GL_ARB_texture_cube_map" )>-1 ARB_Texture_Border_Clamp = Ext.Find( "GL_ARB_texture_border_clamp" )>-1 ARB_Texture_Mirrored_Repeat = Ext.Find( "GL_ARB_texture_mirrored_repeat" )>-1 glGetIntegerv( GL_MAX_TEXTURE_UNITS_ARB, Varptr MaxTextureUnits ) glGetIntegerv( GL_MAX_TEXTURE_SIZE, Varptr MaxTextureSize ) glGetIntegerv( GL_MAX_ATTRIB_STACK_DEPTH, Varptr MaxAttribStackDepth ) glGetIntegerV( GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, Varptr MaxClientAttribStackDepth ) glGetIntegerv( GL_MAX_CLIP_PLANES, Varptr MaxClipPlanes ) glGetIntegerv( GL_MAX_3D_TEXTURE_SIZE, Varptr Max3DTextureSize ) glGetIntegerv( GL_MAX_CUBE_MAP_TEXTURE_SIZE, Varptr MaxCubeMapTextureSize ) glGetIntegerv( GL_MAX_LIGHTS, Varptr MaxLights ) glGetIntegerv( GL_MAX_MODELVIEW_STACK_DEPTH, Varptr MaxModelViewStackDepth ) glGetIntegerv( GL_MAX_PROJECTION_STACK_DEPTH, Varptr MaxProjectionStackDepth ) glGetIntegerv( GL_MAX_TEXTURE_LOD_BIAS, Varptr MaxTextureLODBias ) glGetIntegerv( GL_MAX_TEXTURE_STACK_DEPTH, Varptr MaxTextureStackDepth ) __glob_glHelp = 1 EndIf End Method End Type
Globals should be kept to a minimum. Local variables are much faster.
Thats true. But global to create type handling list structures (to have a way to say when to destroy an element) are just great :)
Or for instance counters.
beside that you are right, normally for stuff like noel did with the ARB anyone would use const, not global :)
Or for instance counters.
beside that you are right, normally for stuff like noel did with the ARB anyone would use const, not global :)
Strict is definitly the way to go. Saves SO MUCH trouble in the long run!
normally for stuff like noel did with the ARB anyone would use const, not global :)
You're... insane?
You can't set constants at runtime, Dreamora. In order to see if a video card supports the extensions, you have to check them at runtime.
ah, you're right
but why didn't you use field instead of global? as you use them on instance base anyway due to method new, it would do the job as well :)
( or replace new with a function init () that does the same)
but why didn't you use field instead of global? as you use them on instance base anyway due to method new, it would do the job as well :)
( or replace new with a function init () that does the same)
So I could do GlHelper.GL_ARB_vertex_buffer_object>0 anywhere in my code without having to create a new instance of the type prior to that.
If it ends up kicking me in the face speed-wise I'll obviously move it to some other means of storage, but thus far I've had no problems.
If it ends up kicking me in the face speed-wise I'll obviously move it to some other means of storage, but thus far I've had no problems.
thats why I put the (..) stuff in :)
I've a similar controlstructure in my particle system which is fully based on Type - Function, Type - const and type - global :)
I've a similar controlstructure in my particle system which is fully based on Type - Function, Type - const and type - global :)
I use Strict in most of my code.
I'm developing some modules for my game (it's not going great, because I lack some inspiration and I don't seem to find the perfect structure for it) and I'm using strict in all those modules.
Only for testing those modules with a separate bmx-file, which imports the module, I'm not using strict.
I'm developing some modules for my game (it's not going great, because I lack some inspiration and I don't seem to find the perfect structure for it) and I'm using strict in all those modules.
Only for testing those modules with a separate bmx-file, which imports the module, I'm not using strict.