Does Option Strict On add overhead?

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Does Option Strict On add overhead?

    By turning Option Strict on, is there extra overhead? For example w/o it on
    the following doesnt get flagged:
    validxhtml.Attributes.Add("height", 22) but with it on the 22 is underlined
    and the message is "Option Strict On disallows implicit conversions from
    'Integer' to 'String'.". I then use validxhtml.Attributes.Add("height",
    cstr(22)) and the blue squiggel goes away with strict on. By using cstr is
    there extra overhead created?


    Showjumper Guest

  2. Similar Questions and Discussions

    1. Zoom effect on a overhead map
      As part of a prototype for a mobile city guide I am trying to implement a zoom in map, whereby portions of a map can be selected and zoomed in on. ...
    2. Option Strict On disallows late binding
      I always get the late binding error with the following method. Is there anyway around this without turning Option Strict Off? Private Sub...
    3. Overhead of objects
      I'm wondering what the overhead is when creating objects, the project I'm currently working on would require many object creations, and I need to...
    4. Imports ANYnamespace.anyClass (overhead??)
      Importing a namespace, is simply shorthand, so you don't have to type the fully qualified name of the class every time. I believe it is only used at...
    5. Include Files and Overhead
      I have a medium sized ecommerce website which I have written using PHP and MySQL and I have a number of include files with some of them being...
  3. #2

    Default Re: Does Option Strict On add overhead?

    The CStr conversion happens whether you have Option Strict on or not.
    So no there isn't any overhead.
    The main difference is that with Option Strict On you are forced to do such
    conversions explicity instead of relying on VB to do them automatically for
    you.
    While this requires a bit of extra work, it is considered to be well worth
    it to help prevent unexpected runtime errors.
    These kinds of bugs can be notoriously difficult to flush out and can be
    very expensive to fix if they are discovered after an app is deployed. This
    is why most good developers will tell you to always turn Option Strict on.

    --
    I hope this helps,
    Steve C. Orr, MCSD
    [url]http://Steve.Orr.net[/url]


    "Showjumper" <shojumper@grkjashdjkf.com> wrote in message
    news:%23XbW4exVDHA.2004@TK2MSFTNGP10.phx.gbl...
    > By turning Option Strict on, is there extra overhead? For example w/o it
    on
    > the following doesnt get flagged:
    > validxhtml.Attributes.Add("height", 22) but with it on the 22 is
    underlined
    > and the message is "Option Strict On disallows implicit conversions from
    > 'Integer' to 'String'.". I then use validxhtml.Attributes.Add("height",
    > cstr(22)) and the blue squiggel goes away with strict on. By using cstr is
    > there extra overhead created?
    >
    >

    Steve C. Orr, MCSD Guest

  4. #3

    Default Re: Does Option Strict On add overhead?

    Option Strict On causes no overhead.

    In fact, it reduces the overhead caused by developers wondering why their
    code didn't work, since it compiled ok.

    In your example, why not use:

    validxhtml.Attributes.Add("height", "22")

    --
    John Saunders
    Internet Engineer
    [email]john.saunders@surfcontrol.com[/email]

    "Showjumper" <shojumper@grkjashdjkf.com> wrote in message
    news:%23XbW4exVDHA.2004@TK2MSFTNGP10.phx.gbl...
    > By turning Option Strict on, is there extra overhead? For example w/o it
    on
    > the following doesnt get flagged:
    > validxhtml.Attributes.Add("height", 22) but with it on the 22 is
    underlined
    > and the message is "Option Strict On disallows implicit conversions from
    > 'Integer' to 'String'.". I then use validxhtml.Attributes.Add("height",
    > cstr(22)) and the blue squiggel goes away with strict on. By using cstr is
    > there extra overhead created?
    >
    >

    John Saunders Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139