|
-
Feb 20th, 2002, 05:59 AM
#1
Option Explict...No need? MUST READ
As we here are probably already aware if the statement Option Explicit appears at the top of a module then all varibles used within must be pre-defined.
The question I put to you all is:
Why does VB, or Microsoft if you prefer, allow coding without the use of Option Explict? It's not rocket science to decalre a varible, so why is it not enforced?
Oh, if anyone read my posts from yesterday regarding finding users logged into an NT network and the puter they are logged into, well I've worked it out. Found some code at planetsource code, here's the link: http://www.planetsourcecode.com/vb/s...11317&lngWId=1
There is only one problem with the above code and that is if a user doesn't access the network server for, say 20 minutes (can't remember exact time delay) then they are displayed as being offline...must be someway around this...Have fun.
Oh yea, answer my original question you ladder monkeys
-
Feb 20th, 2002, 06:07 AM
#2
Fanatic Member
It was a design decision - simple as that.....
Read pages 9 - 11 of Hardcore Visual Basic by Bruce McKinney for more info.....you can find it here.....
www.mvps.org/vb
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Feb 20th, 2002, 06:12 AM
#3
Bouncy Member
well if you don't use Option Explicit, you can use variables without defining them first.
i.e.
dunno whether this will make bob a integer, long or what though?
-
Feb 20th, 2002, 06:13 AM
#4
-
Feb 20th, 2002, 06:14 AM
#5
Fanatic Member
bob will be declared as a variant internally, and the variant will contain meta info about it's contents to define what type it is.....thats part of the reason that variants are slow.....
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Feb 20th, 2002, 06:16 AM
#6
Bouncy Member
well i suppose the only benefit is that it allows you to create a program extremely fast since you don't have to bother with a few extra lines of code etc, checking variable types etc.
although it will be buggy, and generally, bad programming...
not something i'd recommend, anyway
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|