Option Strict ON - WHY use it???

  • Thread starter Thread starter Microsoft News
  • Start date Start date
It's definitely a good read and I agree, that security stuff was a pain - i
can't get to mine either ;-(
 
Bill,

Because we had a discussion in this newsgroup where I wrote something the
same as you although I wrote something more. I was almost sure that there
would be a reaction on my text so there could be a discussion.

Greg answered it by the way. In the context as you write it now does it
nothing. Option Strict On prevents you from writting bad programs. Option
Strict On or Off does nothing when the program is already writen right.

Cor
 
Cor Ligthert said:
Greg answered it by the way. In the context as you write it now does it
nothing. Option Strict On prevents you from writting bad programs. Option
Strict On or Off does nothing when the program is already writen right.

W.G. Ryan replied to a post that was talking about the bad performance
impact of heavily using late binding -- which is only possible with 'Option
Strict Off'.
 
Herfried,

It is only to show him to be a little bit more prudence. He wrote that more
in this style and the ones who don't know can think it is a kind of a
booster. I know Bill from other newsgroups.

Cor
 
Option Strict On or Off does nothing when the program is already writen

My gut reaction is to agree with you on this. But Bill (I thought) was
suggesting that there is more to it. I am waiting for my eBook from
Appleman to arrive to see what his thoughts are on the subject.

I'll let you know what I find.

Greg
 
Cor:

I'm not sure I follow you. If you have Option Strict OFF - it's next to
impossible to write your code and not make any violations if your project is
of any notable size. You could take the same argument you made to Option
Explicit and it would be technically correct. Realisitically though it's
not because chances are you'll make a typo with Explicit Off and more than
likely you'll violate if you have Strict off. Actually, it's not just more
than likely - it's practically guaranteed that on something of any size 500+
lines, that hitting everything exactly and making no violations will not
occur.

Forgetting one single conversion in a big loop is all it takes to degrade
performance.
 
Bill,

As Greg stated, when you make your program completly with Option Strict On
and than put it to Option Strict Off, there will be no difference. This is
the same as was in a discussion last week about the same topic.

That does not mean that we don't agree, you would have seen offently when
you visit this message or the dotnet general newsgroup that I write this
everytime and tell than often, while that is because Option strict On
prefent writing programs with late binding. (Although there can still be
used reflection)

With Option Strict On
VBNet = C#
with OF
VBNet = VB6

This writting was exactly the reason from that thread past week where
Herfried told that this was not always true, however he forgot that I had as
well that statement about late binding in my message.

Probably exactly the reason why Herfried pointed me on the fact that the
message you answered was about late binding.

Cor
 
To much text changes again.

you visit this message or the dotnet general newsgroup

delete "message"

Cor
 
Bill,

I just got a chance to read the chapter "Option Slow On". I did not come
away with the same conclusion you state here. Nowhere did Appleman state
(or imply) that Option Strict On by itself makes your code run faster. It
is simply the coding style (strict type checking) that it enforces that
provides the speed benefit.

Please take another look for yourself. :^)

Happy New Year!

Greg
 
Greg Burns said:
I just got a chance to read the chapter "Option Slow On". I did not come
away with the same conclusion you state here. Nowhere did Appleman state
(or imply) that Option Strict On by itself makes your code run faster. It
is simply the coding style (strict type checking) that it enforces that
provides the speed benefit.

One could easily check that by comparing the IL of the same application,
compiled with 'Option Strict Off' and 'Option Strict On'.
 
Back
Top