Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Discussions (General)
 Option explicit can not be used
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

ajhvdb
Junior Member

Netherlands
392 Posts

Posted - 27 August 2002 :  17:56:52  Show Profile
I'm sorry but while i'm working on a Mod I always use OPTION EXPLICIT

In the previous version I got much more undeclared var errors so I'm assuming you want to get rid of them.

I know sometimes you can't declare a var because of all the different include's.

This is not a bug but maybe if you've the time could you declare and change some source
in the standard code. I know it's working now but later on you will need a lot debugging
finding errors with different var names.

If I find more things (to do's) like this can I post them also or not?


in file "config.asp" declare:
Dim scriptname, strCookieURL, strUniqueID, blnSetup, strDBNTSQLName, my_Conn, strDBNTUserName
Dim strDBNTFUserName, chkCookie



in file "inc_func_common.asp"

around line 258 in function HTMLEncode(pString)
	Dim fString
around line 267 in function HTMLDecode(pString)
	Dim fString

around line 276 in function chkString(pString,fField_Type)
	Dim fString
ChkString = fString -->must be chkString
around line 365 in function chkString(pString,fField_Type)

		Case "edit"
if strAllowHTML <> "1" then
fString = HTMLEncode(fString)
end if
fString = Replace(fString, """", """)
ChkString = fString
exit function

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 27 August 2002 :  19:13:03  Show Profile
It has never been our goal to be able to use Option Explicit. Dimming Variables is not a requirement.
Go to Top of Page

@tomic
Senior Member

USA
1790 Posts

Posted - 27 August 2002 :  19:38:28  Show Profile  Visit @tomic's Homepage  Send @tomic an ICQ Message
There are reasons to Dim though. I thought doing that could potentially improve performance even if slightly and perhaps more importantly it's been suggested that doing this aides in a transition to .NET

@tomic

SportsBettingAcumen.com
Go to Top of Page

ajhvdb
Junior Member

Netherlands
392 Posts

Posted - 28 August 2002 :  04:11:29  Show Profile
quote:
Originally posted by RichardKinser

It has never been our goal to be able to use Option Explicit. Dimming Variables is not a requirement.




As I said some developers updated some of them but Ok I won't report them anymore.
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 28 August 2002 :  04:20:27  Show Profile
Option Explicit is good for debugging. But after you finish debugging you can remove it. Because you don't need it unless you start working on the code again.

Support Snitz Forums
Go to Top of Page

e3stone
Average Member

USA
885 Posts

Posted - 12 October 2002 :  14:50:56  Show Profile  Send e3stone an AOL message
Option Explicit is good for developers, but after your code is finalized, then it's good to remove the Option Explicit. I've read that it can actually hender performance if you leave it in there.

<-- Eric -->
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 12 October 2002 :  19:01:34  Show Profile  Visit Gremlin's Homepage
Yes there is a Performance hit, avoid option explicit in production code.

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 12 October 2002 :  20:00:20  Show Profile
I always use option explicit. Microsoft, 4guys, 15seconds and many other sites all refer to an increase in asp performance using option explicit.





======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 12 October 2002 :  20:36:09  Show Profile  Visit Gremlin's Homepage
Everything I've ever read says otherwise actually, there *is* an increase by Dim'ing your variables, but with option explicit the parser has to do an extra pass (or at least a more complex first pass) over the script to ensure everything is dimmed correctly hence the loss in performance.


Kiwihosting.Net - The Forum Hosting Specialists

Edited by - Gremlin on 12 October 2002 20:37:28
Go to Top of Page

bjlt
Senior Member

1144 Posts

Posted - 12 October 2002 :  20:52:17  Show Profile
quote:
Originally posted by RichardKinser

It has never been our goal to be able to use Option Explicit. Dimming Variables is not a requirement.



However, thanks ajhvdb for the report, as proper dimming may improve performance, it's worth to do it sometime by somebody and adjust it in the base code, if not now.

use option explicit in the development while remove it in the final product.

Just my $0.2.

Edited by - bjlt on 12 October 2002 20:53:52
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 12 October 2002 :  20:56:43  Show Profile
I have always relied on this page as my first source of "how-to" tips.

http://msdn.microsoft.com/library/default.asp?URL=/library/en-us/dnasp/html/ASPtips.asp

I just did a search on google for "option explicit" asp performance and came up with these articles too.

http://www.4guysfromrolla.com/webtech/faq/Intermediate/faq6.shtml
http://www.15seconds.com/faq/Performance/763.htm
http://www.aspemporium.com/aspEmporium/tutorials/speedyASP.asp

The reason these articles says option explicit enhances performance makes sense to me. The interpreter will initially do more work by building the collection of variables, but after that pass any code that references any of the variables will be much quicker. Without option explicit, it seems to me the interpreter will have to look for the variable name when the code runs, and if it doesn't find the variable at that point it will have to create the variable storage on the fly. I suspect the net result will be a slightly longer time to reference each variable.

I don't have any data to back this up, though

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 12 October 2002 :  21:34:21  Show Profile  Visit Gremlin's Homepage
Could be another case of it was "this way" under ASP2.0 and now its the complete opposite under ASP3.0 as well :)

To be honest I'm just damm lazy and don't use explicit full stop

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

GauravBhabu
Advanced Member

4288 Posts

Posted - 12 October 2002 :  21:43:04  Show Profile
I always prefer to use option explicit. I have several files of snitz already complete with each variable dimmed
Go to Top of Page

work mule
Senior Member

USA
1358 Posts

Posted - 12 October 2002 :  22:42:25  Show Profile
wow...I can't believe my eyes...

Personally, I've always tried to use Option Explicit whenever I can. Like Doug said, Microsoft and everyone else has always said that it should be used when possible. Not only is it a performance thing, but also helps to avoid some problems later down the road.

I honestly can't recall ever reading anything that recommended not to use Option Explicit for performance reasons.
Go to Top of Page

bjlt
Senior Member

1144 Posts

Posted - 12 October 2002 :  23:46:39  Show Profile
I've seen articles say that it's better to remove it in the final production, however I don't know if it's the same for 3.0. Well I think it's good to use it while programming and remove it finally, as you know all variables are declared there's no need for the check and you know nothing will be treated as a variable on the flash.
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 13 October 2002 :  01:20:39  Show Profile  Visit Gremlin's Homepage
Dim'ing a variable still leaves it as a variant type until such time as a value has been assigned to it, unlike Const which does cast the variable type immediately (but then your assigning a value to it immediately as well).

I know pleanty of sites claim performance is better with it switched on, but I've never seen anything to actually back that up, I'm sure theres some truth in it like most things, I didn't believe Context Switching was over 10% faster than pure Response.Write either till I actually tested it myself.

Guess maybe I'm just stubborn.


Kiwihosting.Net - The Forum Hosting Specialists

Edited by - Gremlin on 13 October 2002 01:21:39
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.7 seconds. Powered By: Snitz Forums 2000 Version 3.4.07