| Author |
Topic Search Topic Options
|
zMaestro
Senior Member
Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
|
Post Options
Thanks(0)
Quote Reply
Topic: simple question... 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.
|
 |
MorningZ
Senior Member
Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
|
Post Options
Thanks(0)
Quote Reply
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
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.aspronline.com/learn/lessons/4/2.asp
|
|
Contribute to the working anarchy we fondly call the Internet
|
 |
zMaestro
Senior Member
Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
|
Post Options
Thanks(0)
Quote Reply
Posted: 20 June 2003 at 3:59pm |
Thanks alot...
Next time I'll go directly to google and not to Web Wiz Guide 
|
 |
MorningZ
Senior Member
Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
|
Post Options
Thanks(0)
Quote Reply
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
Edited by MorningZ
|
|
Contribute to the working anarchy we fondly call the Internet
|
 |
Gullanian
Senior Member
Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
|
Post Options
Thanks(0)
Quote Reply
Posted: 20 June 2003 at 5:31pm |
|
ohhhhhhhhhhhh........ handbags!
|
 |
zMaestro
Senior Member
Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
|
Post Options
Thanks(0)
Quote Reply
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") 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. 
Edited by zMaestro
|
 |
MorningZ
Senior Member
Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
|
Post Options
Thanks(0)
Quote Reply
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
|
 |
zMaestro
Senior Member
Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
|
Post Options
Thanks(0)
Quote Reply
Posted: 22 June 2003 at 2:11am |
some very helpful links are here...
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
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
|
 |