Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - simple question...
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

simple question...

 Post Reply Post Reply Page  12>
Author
zMaestro View Drop Down
Senior Member
Senior Member


Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
Post Options Post Options   Thanks (0) Thanks(0)   Quote zMaestro Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
zMaestro View Drop Down
Senior Member
Senior Member


Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
Post Options Post Options   Thanks (0) Thanks(0)   Quote zMaestro Quote  Post ReplyReply Direct Link To This Post Posted: 20 June 2003 at 3:59pm

Thanks alot...

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

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 20 June 2003 at 5:31pm
ohhhhhhhhhhhh........ handbags!
Back to Top
zMaestro View Drop Down
Senior Member
Senior Member


Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
Post Options Post Options   Thanks (0) Thanks(0)   Quote zMaestro Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
zMaestro View Drop Down
Senior Member
Senior Member


Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
Post Options Post Options   Thanks (0) Thanks(0)   Quote zMaestro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.