Print Page | Close Window

simple question...

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=3702
Printed Date: 28 March 2026 at 8:51pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: simple question...
Posted By: zMaestro
Subject: simple question...
Date Posted: 20 June 2003 at 2:02pm

I have a simple question, something I used to write in the begining of ASP Pages while I don't really know its function...


<% @ Language = VBScript %>
<%
Option Explicit
With Response
 .Buffer = True
 .Expires = 0
 .Clear
End With
%>

the only difference i knew is that it force me to define every variable in the page!!!!
Can you please tell me the reasons for writing it, or recommend a thread discussing it to read.

Thanks.




Replies:
Posted By: MorningZ
Date Posted: 20 June 2003 at 2:40pm

Option Explicit (searching google for "Option Explicit" believe it or not):
http://www.4guysfromrolla.com/webtech/faq/Intermediate/faq6.shtml - http://www.4guysfromrolla.com/webtech/faq/Intermediate/faq6.shtml

For the Response stuff, and how about this, typed "Response Buffer" in google and got the following:
http://www.asp101.com/tips/index.asp?id=87 - http://www.asp101.com/tips/index.asp?id=87
http://www.aspronline.com/learn/lessons/4/2.asp - http://www.aspronline.com/learn/lessons/4/2.asp



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: zMaestro
Date Posted: 20 June 2003 at 3:59pm

Thanks alot...

Next time I'll go directly to google and not to Web Wiz Guide



Posted By: MorningZ
Date Posted: 20 June 2003 at 5:23pm

so let me get this straight....

i took time to goto google myself, search for your answers, and then posted a few links to answer your questions exactly... and i get that wise ass reply...

hmmm.. maybe if i coded your whole application it'd be a bit more appreciated.... but probably not

anyways, google (especially google 'groups') have tons of info from mainy years, and what's better than asking a general question and getting an answer right away??

ah well, take it or leave it..... i tried to help at least



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: Gullanian
Date Posted: 20 June 2003 at 5:31pm
ohhhhhhhhhhhh........ handbags!


Posted By: zMaestro
Date Posted: 21 June 2003 at 1:50am

take it easy.. I said "Thanks alot..." , I really mean it... plus it is me who asked for a thread to read...

But yet, I didn't find any reason for writing these lines of codes but only to force us to define variables which make tracking error easy. HE says (" http://www.4guysfromrolla.com/webtech/faq/Intermediate/faq6.shtml - http://www.4guysfromrolla ") that it may too fast the process by 10%, although I doubt this because the whole process is done on the Server, and this 10% will be very difficult to detect.

so, Are these the only reasons for writing the Option Explicit?

 

Thanks Morningz for your help, I really appretiate it.

 

 



Posted By: MorningZ
Date Posted: 21 June 2003 at 10:14am

well:
- if you dont want it easier to track down your errors..... (ANYTHING to help error tracking should be good in any programmer's eyes)
- or don't want a free 10% gain in performace... (Every bit counts!)

Then don't use Option Explicit.. easy as that.....  i am unsure what else you want-to-hear/are-looking-for



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: zMaestro
Date Posted: 22 June 2003 at 2:11am

some very helpful links are here...

http://www.asp-help.com/getstarted/ms/vbscript/382.asp - http://www.asp-help.com/getstarted/ms/vbscript/382.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmOptionExplicit.asp - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmOptionExplicit.asp

 

The ONLY use of Option Explicit is you must explicitly declare all variables using the Dim, Private, Public, or ReDim statements. If you attempt to use an undeclared variable name, an error occurs at compile time. i.e. Used at file level to force explicit declaration of all variables in that file.

If you don't use the Option Explicit statement, all undeclared variables are of Object type.

Note:  Use Option Explicit to avoid incorrectly typing the name of an existing variable or to avoid confusion in code where the scope of the variable is not clear. If you do not specify Option Explicit in your code, the compiler default is Option Explicit On.

 

That's to be a reference for any one else who has a simple question regading the Option Explicit



Posted By: zMaestro
Date Posted: 22 June 2003 at 2:16am
btw... Option Explicit has NOTHING to do to fast the downloading of any asp page, and it's not a "use" of Option Explicit...


Posted By: MorningZ
Date Posted: 22 June 2003 at 3:08am

no one said fast downloading, its all about "processing time".....

another advantage, and this is if you use Interdev for your development...

anything declared in the page can be quickly pulled up with intellisense..... so if i have:

Dim SomeVariable

in the page, i can type:

Som(hit control-space here) and "SomeVariable" will show up.. less typing is better



-------------
Contribute to the working anarchy we fondly call the Internet



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net