473,396 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

VB Compiler Warnings & other woes ...

Hi All,

In Visual Basic .NET , your function definition might requirre you to return
a value but (accidently/intentionally) you dont put any 'return value' in
the function.

In this case VB Compiler does not generate any warning.

Is there any way to make the compiler generate this and other obvious
warnings, is there any switch, or still VB.NET development team assumes that
the VB developers use the language as a toy language.

And doesnt one think that the Warning and Error generated by VB Compiler
should match that of C#.

And when are we gonna get rid of 'Option Strict Off' and make 'Option Strict
On' a necessity rather than an option - shouldnt this be default.

Will VB.NET , despite its powers matching to that of C# , will always remain
as a toy language ??????

Thank you,
rawCoder
Nov 20 '05 #1
5 1770
guy
Totally agree:-)
I just posted virtually the same thing to the DotNet.General group, I got 2 posts supporting and one against. Also cross-posted to the Studio 2005 VB newsgroup no replies yet.
personally i would much rather type
BitBucket=MyFunction(....
if I didnt want the return value and have errors trapped at compile time than mess about at run time trying to find them.

guy

"rawCoder" wrote:
Hi All,

In Visual Basic .NET , your function definition might requirre you to return
a value but (accidently/intentionally) you dont put any 'return value' in
the function.

In this case VB Compiler does not generate any warning.

Is there any way to make the compiler generate this and other obvious
warnings, is there any switch, or still VB.NET development team assumes that
the VB developers use the language as a toy language.

And doesnt one think that the Warning and Error generated by VB Compiler
should match that of C#.

And when are we gonna get rid of 'Option Strict Off' and make 'Option Strict
On' a necessity rather than an option - shouldnt this be default.

Will VB.NET , despite its powers matching to that of C# , will always remain
as a toy language ??????

Thank you,
rawCoder

Nov 20 '05 #2
> > In Visual Basic .NET , your function definition might requirre you to
return
a value but (accidently/intentionally) you dont put any 'return value' in the function.

In this case VB Compiler does not generate any warning.

Is there any way to make the compiler generate this and other obvious
warnings, is there any switch, or still VB.NET development team assumes that the VB developers use the language as a toy language.

Surely it becomes very obvious when your function returns "Nothing". You do
"test" your code after you write it... right?
And doesnt one think that the Warning and Error generated by VB Compiler
should match that of C#.
Why?

And when are we gonna get rid of 'Option Strict Off' and make 'Option Strict On' a necessity rather than an option - shouldnt this be default.
Microsoft haven't made it a neccessity so that all of those applications
written in non OOP VB will have an easy upgrade path. Microsoft believe the
developer is the best person to decide what does and doesn't work for them
and their individual.... just because you dont like it, doesn;t mean it's
not for everybody. Your essentially asking "Why is the langauge so
flexible?" which is a weird complaint.

Will VB.NET , despite its powers matching to that of C# , will always remain as a toy language ??????


Well now that depends on whose is using it?
The language and toolset that accompanies it are incredibly powerful. If all
you've managed to build with it are "toys" then i would suggest you
undertake some further training.

hth
Richard
Nov 20 '05 #3
Dear Richard,

I think I was unable to make myself clear.

What I meant was that " By Default " the language should be as rigid as C# -
atleast at compiler level.
And you might be allowed to write as crappy code as possible to make it
flexible and to support VB6 code which I suppose is what you prefer under
the flag of FLEXIBILITY.

Have you seen the writing on the wall, it clearly says that Microsoft is
trying to promote VB as an inferior language as compared to C# despite the
reality.

Why is it so that the recent Data Structures Articles on MSDN are made using
C# ONLY ???
Why most of the Controls and Class Libraries are written in C# ???
Why in the casestudies section of Microsoft site, its hard to find a
solution in VB.NET ???

Thats what i was referring to - VB is made to look like a language that
makes toys.

Everyone knows that the only diefference between VB and C# is that of syntax
and unsafe code.
Even then this biased promotion is both frustating and uncomprehendable.
I am really sorry in advance but I beleive your first and last comments are
a direct attack on my credibility
and competence ....

Well I am not aware if you have ever worked on any large project comprising
of large number of developers and modules.
In such scenarios, you need a little help from the compiler - which is
priceless when you are debugging.
What are compiler warnings - they are clues that there might be something
wrong.
Every one can make a mistake. That mistake can result in frustation and time
spent debugging the code.
Some of these mistakes can easily be tackled by compiler warnings.
In C++ , its is a recommended practice that you write your code to promote
compile time errors rather than runtime.
And I hope you wont deny the fact that Runtime Errors are far more difficult
to catch and fix rather than simple Compile Time Errors.

And I hope you understand that my idea of TOY was by no means based on what
I develop with VB.NET , rather what is promoted.

Thank You for your comments anyways.
rawCoder.
"Richard Myers" <ri*********************@basd.co.nz> wrote in message
news:ec**************@TK2MSFTNGP09.phx.gbl...
In Visual Basic .NET , your function definition might requirre you to return a value but (accidently/intentionally) you dont put any 'return value' in the function.

In this case VB Compiler does not generate any warning.

Is there any way to make the compiler generate this and other obvious
warnings, is there any switch, or still VB.NET development team assumes
that
the VB developers use the language as a toy language.

Surely it becomes very obvious when your function returns "Nothing". You do "test" your code after you write it... right?
And doesnt one think that the Warning and Error generated by VB
Compiler should match that of C#.

Why?

And when are we gonna get rid of 'Option Strict Off' and make 'Option Strict On' a necessity rather than an option - shouldnt this be default.
Microsoft haven't made it a neccessity so that all of those applications
written in non OOP VB will have an easy upgrade path. Microsoft believe

the developer is the best person to decide what does and doesn't work for them
and their individual.... just because you dont like it, doesn;t mean it's
not for everybody. Your essentially asking "Why is the langauge so
flexible?" which is a weird complaint.

Will VB.NET , despite its powers matching to that of C# , will always remain as a toy language ??????

Well now that depends on whose is using it?
The language and toolset that accompanies it are incredibly powerful. If

all you've managed to build with it are "toys" then i would suggest you
undertake some further training.

hth
Richard


Nov 20 '05 #4
I think I was unable to make myself clear.
Yup!

What I meant was that " By Default " the language should be as rigid as C# - atleast at compiler level.
You've completely overlooked the fact the C# is a new language. It doesn;t
have a direct legacy language path of evolution to consider. VB.Net does. I
suggest you step out from behind your own monitor and look at the big
picture.... from Microsofts point of view...rather than just your own.

And you might be allowed to write as crappy code as possible to make it
flexible and to support VB6 code which I suppose is what you prefer under
the flag of FLEXIBILITY.
Well again, that would be your connotation....your the one with the problem.
If you want to rewrite the upgrade wizard for Microsoft so that it does a
perfect conversion then im sure they would be willing to pay you.
Have you seen the writing on the wall, it clearly says that Microsoft is
trying to promote VB as an inferior language as compared to C# despite the
reality.
Your contridicting yourself here. Despite what reality?
Why is it so that the recent Data Structures Articles on MSDN are made using C# ONLY ???
Why most of the Controls and Class Libraries are written in C# ???
Why in the casestudies section of Microsoft site, its hard to find a
solution in VB.NET ???
Perhaps because VB.Net has a natural audience, VB6 programmers. Whereas C#
being a new langauge does not. In order to attract Java developers to the
..Net platform Microsoft overemphasises C#. Its good business sense.
And as for controls and class libraries... who cares? Its all MSIL by the i
use it anyway?
Thats what i was referring to - VB is made to look like a language that
makes toys. Everyone knows that the only diefference between VB and C# is that of syntax and unsafe code. Even then this biased promotion is both frustating and uncomprehendable.

Well i disagree with half of that and dont understand what you've said in
the other half.

I am really sorry in advance but I beleive your first and last comments are a direct attack on my credibility and competence ....
Im sure the VB.Net could feel the same about your post.
Well I am not aware if you have ever worked on any large project comprising of large number of developers and modules.
In such scenarios, you need a little help from the compiler - which is
priceless when you are debugging.
And we get plenty. The size of the project is a misnomer. Any half wit
systems architect is going to functionally decompose his project into
managable chunks. To suggest that there is something wrong with the language
because it doesn;t spoonfeed you your code is a classic case of the poor
workman blaming his tools. If your projects are that unweildy, sack your SA.

Lets say it did force a 'Return'. What happens if the variable your
returning is nothing i.e it hasn;t been initialised. You've still got
precisely the same problem, and this can only be detected at runtime. Its
not the compilers fault the developer is sloppy. So what difference does it
make? Thats why we unit test, right?
What are compiler warnings - they are clues that there might be something
wrong.
Every one can make a mistake. That mistake can result in frustation and time spent debugging the code.
No kidding.
Some of these mistakes can easily be tackled by compiler warnings.
Well as above different error, same problem. You still have to test and i'd
sack anybody who had trouble finding such a basic error. I mean really, a
function that doesn't return a value, shouldn;t even make it to the testers,
thats just piss poor coding and no one will convince me other wise.
In C++ , its is a recommended practice that you write your code to promote
compile time errors rather than runtime.
But this is VB.Net? C++ might as well be from another planet.
And I hope you wont deny the fact that Runtime Errors are far more difficult to catch and fix rather than simple Compile Time Errors.
Generally speaking sure..... but you're talking about a very specific
runtime error and for that Ive gotta say "C'mon"?
And I hope you understand that my idea of TOY was by no means based on what I develop with VB.NET , rather what is promoted.


Well obviously i completely disagree. Your right I know nothing of you,
wouldn;t know you from a bar of soap, but im always sceptical about anyone
claiming to be pushing the boundaries of any language. Aren;t you just
contridicting yourself.... on the one hand you say "All Microsoft is
allowing us to build with such a *your beliefs* second rate language is TOYS
and then in the same breath you go onto say "but i develop so much more than
just TOYS".

If so then whats your problem?

Richard

Nov 20 '05 #5
guy
looks like MS thinks you are wrong Richard

From vs2005 bv newsgroup post...

Subject: function return values
From: "[MS]Jo**@data.vb" <an*******@discussions.microsoft.com> Sent: 7/2/2004 12:56:27 PM


Yes, you will get this warning in vs 2005. Check this
feature out in the beta1.
Also you will get a green squiggle in the function with
nice tooltips to indicate what is going on.

Jo**@data.vb

This posting is provided "AS IS" with no warranties, and
confers no rights.

..

sorry for the cross post (dotnet.general....)

It would be really nice if we could have an
Option VeryStrict (or similar)
that caused a compilation warning or error for function
calls that did not assign return values
eg
Split(MyString,",")
instead of
MyArray = Split(MyString,",")

The time overhead of having to type Bitbucket= ...
when i dont need the return value would be more than
recovered by having bugs trapped at compile time rather
than runtime.

cheers

gu

..

"Richard Myers" wrote:
I think I was unable to make myself clear.


Yup!

What I meant was that " By Default " the language should be as rigid as

C# -
atleast at compiler level.


You've completely overlooked the fact the C# is a new language. It doesn;t
have a direct legacy language path of evolution to consider. VB.Net does. I
suggest you step out from behind your own monitor and look at the big
picture.... from Microsofts point of view...rather than just your own.

And you might be allowed to write as crappy code as possible to make it
flexible and to support VB6 code which I suppose is what you prefer under
the flag of FLEXIBILITY.


Well again, that would be your connotation....your the one with the problem.
If you want to rewrite the upgrade wizard for Microsoft so that it does a
perfect conversion then im sure they would be willing to pay you.
Have you seen the writing on the wall, it clearly says that Microsoft is
trying to promote VB as an inferior language as compared to C# despite the
reality.


Your contridicting yourself here. Despite what reality?
Why is it so that the recent Data Structures Articles on MSDN are made

using
C# ONLY ???
Why most of the Controls and Class Libraries are written in C# ???
Why in the casestudies section of Microsoft site, its hard to find a
solution in VB.NET ???


Perhaps because VB.Net has a natural audience, VB6 programmers. Whereas C#
being a new langauge does not. In order to attract Java developers to the
..Net platform Microsoft overemphasises C#. Its good business sense.
And as for controls and class libraries... who cares? Its all MSIL by the i
use it anyway?
Thats what i was referring to - VB is made to look like a language that
makes toys. Everyone knows that the only diefference between VB and C# is

that of syntax
and unsafe code. Even then this biased promotion is both frustating and

uncomprehendable.

Well i disagree with half of that and dont understand what you've said in
the other half.

I am really sorry in advance but I beleive your first and last comments

are
a direct attack on my credibility and competence ....


Im sure the VB.Net could feel the same about your post.
Well I am not aware if you have ever worked on any large project

comprising
of large number of developers and modules.
In such scenarios, you need a little help from the compiler - which is
priceless when you are debugging.


And we get plenty. The size of the project is a misnomer. Any half wit
systems architect is going to functionally decompose his project into
managable chunks. To suggest that there is something wrong with the language
because it doesn;t spoonfeed you your code is a classic case of the poor
workman blaming his tools. If your projects are that unweildy, sack your SA.

Lets say it did force a 'Return'. What happens if the variable your
returning is nothing i.e it hasn;t been initialised. You've still got
precisely the same problem, and this can only be detected at runtime. Its
not the compilers fault the developer is sloppy. So what difference does it
make? Thats why we unit test, right?
What are compiler warnings - they are clues that there might be something
wrong.
Every one can make a mistake. That mistake can result in frustation and

time
spent debugging the code.


No kidding.
Some of these mistakes can easily be tackled by compiler warnings.


Well as above different error, same problem. You still have to test and i'd
sack anybody who had trouble finding such a basic error. I mean really, a
function that doesn't return a value, shouldn;t even make it to the testers,
thats just piss poor coding and no one will convince me other wise.
In C++ , its is a recommended practice that you write your code to promote
compile time errors rather than runtime.


But this is VB.Net? C++ might as well be from another planet.
And I hope you wont deny the fact that Runtime Errors are far more

difficult
to catch and fix rather than simple Compile Time Errors.


Generally speaking sure..... but you're talking about a very specific
runtime error and for that Ive gotta say "C'mon"?
And I hope you understand that my idea of TOY was by no means based on

what
I develop with VB.NET , rather what is promoted.


Well obviously i completely disagree. Your right I know nothing of you,
wouldn;t know you from a bar of soap, but im always sceptical about anyone
claiming to be pushing the boundaries of any language. Aren;t you just
contridicting yourself.... on the one hand you say "All Microsoft is
allowing us to build with such a *your beliefs* second rate language is TOYS
and then in the same breath you go onto say "but i develop so much more than
just TOYS".

If so then whats your problem?

Richard

Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: dis | last post by:
I've been going through my code and clearing away some of the compiler warnings that i'm generating and i've come across areas where i cast pointers to integer values. The Visual Studio compiler...
20
by: News | last post by:
I'm new to c and gcc. I was wondering if anyone can point me to a web page or book that has a list of the warning messages and their meanings. Are the warnings the same no matter what compiler...
8
by: Charlie Zender | last post by:
Hi, First, this may be a GCC or Linux-specific problem, I'm not sure. I am unable to compile a large body of code with extremely pedantic compile time checks activate, so that warnings cause...
43
by: Anitha | last post by:
Hi I observed something while coding the other day: if I declare a character array as char s, and try to use it as any other character array..it works perfectly fine most of the times. It...
2
by: Samuel | last post by:
Imagine you have the following code: try { ... } catch (ThreadAbortException eThread) { if (WorkStopped != null) WorkStopped(this, EventArgs.Empty) }
11
by: Charles Sullivan | last post by:
I have a number of functions, e.g.: int funct1( int arg1, int arg2, int arg3 ); int funct2( int arg1, int arg2, int arg3 ); int funct3( int arg1, int arg2, int arg3 ); that are called via...
1
by: mjobbe | last post by:
I have an installer that requires three merge modules (ATL, CRT, and MFC), and after adding them in, I get the following warnings when I build the MSI: WARNING: Two or more objects have the same...
3
by: gil | last post by:
Hi, I'm trying to find the best way to work with compiler warnings. I'd like to remove *all* warnings from the code, and playing around with the warning level, I've noticed that compiling with...
3
by: Peted | last post by:
Hi Im using vs2008 c# 3.0 and am going through some other person(s) code to clean up compiler warnings that are bieng produced. I have this code (at bottom) where a delegate/event is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.