Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Option Explicit usage
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Option Explicit usage

 Post Reply Post Reply
Author
Tigerworks View Drop Down
Newbie
Newbie
Avatar

Joined: 13 December 2003
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tigerworks Quote  Post ReplyReply Direct Link To This Post Topic: Option Explicit usage
    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.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post 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 
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
KCWebMonkey View Drop Down
Senior Member
Senior Member
Avatar
Go Chiefs!

Joined: 21 June 2002
Status: Offline
Points: 1319
Post Options Post Options   Thanks (0) Thanks(0)   Quote KCWebMonkey Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post 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))



Edited by Mart
Back to Top
 Post Reply Post Reply

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.