Print Page | Close Window

Option Explicit usage

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=10714
Printed Date: 31 March 2026 at 11:50am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Option Explicit usage
Posted By: Tigerworks
Subject: Option Explicit usage
Date Posted: 03 June 2004 at 9:58am
Option Explicit is useful for debugging scripts - but should you include it in finished websites? It's handy when testing your page but should you leave it in or take it out when you upload to the server?
Does the server use more/less resources or read the page faster/slower with Option Explicit?
I just noticed I had it still in my site's headers, not sure if I should take it out.



Replies:
Posted By: WebWiz-Bruce
Date Posted: 03 June 2004 at 10:38am
I always leave it in, it's better programming practice.

Most langauges have it enabled by default and in VB.NET Microsoft have finally enabled it by default so you no longer have to enable it at the begining of each application.

-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: Semikolon
Date Posted: 03 June 2004 at 12:35pm
and man how much work it will be to delete Option Explicit on top of all pages when uploading and put it in place again when editing 


Posted By: Mart
Date Posted: 03 June 2004 at 3:11pm
I also read somewhere a while ago that it has performance benefits aswell. Can't remember why it was though


Posted By: KCWebMonkey
Date Posted: 04 June 2004 at 7:39pm
...and now with VB.net, you also have "option strict" which, coincidentally, is even stricter than option explicit. it makes you write out all your code, with not much room for shortcuts.


Posted By: Mart
Date Posted: 05 June 2004 at 5:04am

And it will not convert types automatically...

I.e. This would throw an exception

Dim x As Integer = 837
Dim s As String = x

You have to go

Dim x As Integer = 837
Dim s As String = CType(x, GetType(String))




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