Results 1 to 6 of 6

Thread: Option Explict...No need? MUST READ

  1. #1

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Talking 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

  2. #2
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    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]

  3. #3
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    well if you don't use Option Explicit, you can use variables without defining them first.

    i.e.

    VB Code:
    1. bob = 3

    dunno whether this will make bob a integer, long or what though?
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  4. #4

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Talking Fish swim, swim, swim some more then die...BORING!

    I understand that, but it doesn't have any benefits...

    I feel that must have been a 2 in the morning descision in the board room...

    Bloke1: *drag* hey man, let's allow users the ability not to be forced to define varibles. *exhale*

    Bloke2: Yea...*drag* That'll get them well confused...This is good gear man

    The above opinion is not one of mine. I have Alien Hand Syndrome which is a recognised illness, can't be blamed...No, leave the keyboard alone *SLAP*

  5. #5
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    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]

  6. #6
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    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
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width