I have a project that was created all with Option Strict OFF. Works great,
not a problem with it. But if I turn Option Strict ON then I get a LOT of
errors.
My question, should I even care about Option Strict?
What advantages do I get with Option Strict On?
Does better type statement make my code run faster?
If anyone knows THE ANSWERS! please fill me in. I have ideas and belief but
I would once and for all like to know what the difference is.
Thank in advance
Clyde W. 30 1849
There are likely many reasons why you should have OPTION STRICT ON all the
time.
My main reason for using it is to watch for narrowing conversions. Places
in code where I might inadvertanly perform a conversion from a double to a
single ore perhaps any floating point value to an integer value.
--
Gerry O'Brien
Visual Basic.NET MVP
"Microsoft News" <Na**@coxinet.n et> wrote in message
news:ur******** ******@TK2MSFTN GP10.phx.gbl... I have a project that was created all with Option Strict OFF. Works great, not a problem with it. But if I turn Option Strict ON then I get a LOT of errors.
My question, should I even care about Option Strict? What advantages do I get with Option Strict On? Does better type statement make my code run faster?
If anyone knows THE ANSWERS! please fill me in. I have ideas and belief but I would once and for all like to know what the difference is.
Thank in advance
Clyde W.
"Microsoft News" <Na**@coxinet.n et> wrote in message
news:ur******** ******@TK2MSFTN GP10.phx.gbl... I have a project that was created all with Option Strict OFF. Works
great, not a problem with it. But if I turn Option Strict ON then I get a LOT of errors.
If you notice the different between having it ON or OFF, then you aren't
programming very well.
Turn it on and fix the errors.
Clyde,
It is up to you, when you are programming in an access kind of way,
scripting way, you can use option strict of and let the computer do things
for you at run time.
This means directly that your program becomes more insecure and does not
have the performance as it could be.
A simple sample.
When you say
dim a as object
a = 1
dim 1 as integer = a
Than this goes with option strict of, however the program does now not know
what conversion should be done at run time and solves it at that moment.
With option strict on it has to be
dim 1 as integer = Cint(a) 'or any other casting, conversion, parsing
command and is it done at run time.
Before you say it, I myself find it strange that this is not build in
automaticly, because the compiler knows this at run time. He tells you that
you that Option Strict Disallows you to do an implicit conversion from
integer to object.
Therefore he can do that in my opinion in design time himself at least by
giving a default which can be choosen with one click. (Or with an option
which tells always to set the standard conversion function in this kind of
situations).
I hope this helps?
Cor
I believe using a lot of late binding will cause your program to run quite a
bit slower.
"Microsoft News" wrote: I have a project that was created all with Option Strict OFF. Works great, not a problem with it. But if I turn Option Strict ON then I get a LOT of errors.
My question, should I even care about Option Strict? What advantages do I get with Option Strict On? Does better type statement make my code run faster?
If anyone knows THE ANSWERS! please fill me in. I have ideas and belief but I would once and for all like to know what the difference is.
Thank in advance
Clyde W.
It definitely will affect performance - not to mention it will greatly
increase the chances of making some hard to find logic errors.
--
W.G. Ryan, MVP www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Dennis" <De****@discuss ions.microsoft. com> wrote in message
news:BF******** *************** ***********@mic rosoft.com... I believe using a lot of late binding will cause your program to run quite
a bit slower.
"Microsoft News" wrote:
I have a project that was created all with Option Strict OFF. Works
great, not a problem with it. But if I turn Option Strict ON then I get a LOT
of errors.
My question, should I even care about Option Strict? What advantages do I get with Option Strict On? Does better type statement make my code run faster?
If anyone knows THE ANSWERS! please fill me in. I have ideas and belief
but I would once and for all like to know what the difference is.
Thank in advance
Clyde W.
Amen!
--
W.G. Ryan, MVP www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Noozer" <do******@me.he re> wrote in message
news:J55Ad.6014 25$%k.374308@pd 7tw2no... "Microsoft News" <Na**@coxinet.n et> wrote in message news:ur******** ******@TK2MSFTN GP10.phx.gbl... I have a project that was created all with Option Strict OFF. Works great, not a problem with it. But if I turn Option Strict ON then I get a LOT
of errors.
If you notice the different between having it ON or OFF, then you aren't programming very well.
Turn it on and fix the errors.
Bill, It definitely will affect performance -
It does not.
Cor
"Cor Ligthert" <no************ @planet.nl> schrieb: It definitely will affect performance -
It does not.
Huh?!
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Herfried K. Wagner [MVP] wrote: "Cor Ligthert" <no************ @planet.nl> schrieb:
It definitely will affect performance -
It does not.
Huh?!
I don't know if it affects performance or not. But I do know this. I
turned it on in my application and now I have about 500 errors to fix!
Thanks alot people! ;)
--
---
Aaron Smith
Remove -1- to E-Mail me. Spam Sucks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Microsoft News |
last post by:
I have a project that was created all with Option Strict OFF. Works great,
not a problem with it. But if I turn Option Strict ON then I get a LOT of
errors.
My question, should I even care about Option Strict?
What advantages do I get with Option Strict On?
Does better type statement make my code run faster?
If anyone knows THE ANSWERS! please fill me in. I have ideas and belief but
I would once and for all like to know what the...
|
by: Daylor |
last post by:
hi.
im using option strict on.
im doing in ,from the simple reason ,to be warn when there are implict
conversion like string to int ,int to string.
BUT.
the price ,(now i see ), is very bad.
if i have class CCar and interface ICar
when im doing this :
ICar = new CCar
|
by: Rich |
last post by:
Hello,
If I leave Option Strict Off I can use the following
syntax to read data from a Lotus Notes application (a
NotesViewEntry object represents a row of data from a
Lotus Notes View - like a record in a sql Server view)
....
Dim entry As Domino.NotesViewEntry
Dim obj As Object
str1 = entry.ColumnValues(0)
|
by: David |
last post by:
Hi all,
I have the following problem: my program works fine, but when I add option
strict at the top of the form, the following sub fails with an error that option
strict does not allow late binding. What should I do?
Public Sub MyMnuHandler(ByVal sender As Object, ByVal e As System.EventArgs)
If sender.checked = True Then sender.checked = False Else sender.checked = True
|
by: guy |
last post by:
when i first started using .net (beta 1) i came across option strict and
thought hey this could be really good, and since then have always turned it
on, most people here seem to agree that this is a good thing.
i have now been asked to debug a vb2005 web app for 3 weeks and there is no
mention of option strict in it, (there are also no classes defined, just a
couple of structures) everything is define as 'as object', data coming back...
| |
by: C. Moya |
last post by:
I fully expected the lack of a way to set Option Strict globally to be fixed
in SP1. I can't seem to figure out if it has been fixed or not. It still
seems we have to add the declaration at the top of each and every single
code module. Am I missing something here?
--
-C. Moya
www.cmoya.com
|
by: Jerad Rose |
last post by:
I believe this issue is specific to ASP.NET. Why does VB.NET (2.0) ignore
the project-level setting for Option Strict?
I have the setting turned on in web.config:
<compilation debug="true" strict="true" explicit="true"
urlLinePragmas="true"/>
And also in the preferences:
|
by: Poldie |
last post by:
How do I turn it on? I'm using vb 2005 in visual studio 2005 sp1.
In my web.config I have:
<compilation debug="true" strict="true" />
In my Tools/Options/Projects and solutions/vb defaults I have option
strict on.
In my .vb file I have:
|
by: Rory Becker |
last post by:
A wise man once said: "Never put off until runtime what you can fix at compile
time."
Actually I think he said it about 10 minutes before I started this post.
I am a firm believer, like the man in question, in "Option Strict On" by
default.
Actually I don't believe I have code where this is not the case.
|
by: =?Utf-8?B?R3JlZw==?= |
last post by:
We have an application in our office that has the Option Strict option set to
off right now. I do understand it should be set to ON, but right now, I'm
just going to continue with it this way since I do not have the time to fix
everything to set it to ON.
Anyway, my question is if its set to OFF why is it it keeps getting set back
to ON, everytime we move the package from one machine to another. It's the
Option Strict option specific to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |