473,626 Members | 3,201 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1785
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=MyFun ction(....
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 uncomprehendabl e.
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******** ******@TK2MSFTN GP09.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 uncomprehendabl e.

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*******@disc ussions.microso ft.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

uncomprehendabl e.

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
11219
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 generates this warning ... "warning C4311: 'type cast' : pointer truncation from 'void *' to 'DWORD'" The warning is generated as the pointer is apparently 64 bits long (even though a quick sizeof() reports it to only be 4 bytes in length) and...
20
2711
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 you use, or are they different for each compiler? I have looked all over the gcc web site, but I can't find anything that explains what the warnings are. If someone could take the time to help me out and direct me to some info about this, I'd...
8
5154
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 errors. With GCC 3.3.1, I do this with gcc -I/usr/local/include -g -O2 -std=c99 -pedantic -pedantic -D_BSD_SOURCE -Wall -Wunused -W -Wmissing-prototypes -Wconversion
43
2705
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 holds strings of any length. I guess what is happening here is that this array initially holds only '\0' and hence is of length 1. But sometimes, when I tried to write some functions and do some
2
1717
by: Samuel | last post by:
Imagine you have the following code: try { ... } catch (ThreadAbortException eThread) { if (WorkStopped != null) WorkStopped(this, EventArgs.Empty) }
11
23222
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 pointers in a table, with the same parameters regardless of the particular function. In some of the functions, one or more of the
1
4292
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 target location ('\8.0.50727.42.cat') WARNING: Two or more objects have the same target location ('\8.0.50727.42.cat')
3
3185
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 /W3 I get warnings that with /W4 are shown as remarks, e.g.: warning #177: variable "Foo" was declared but never referenced ....is displayed as a "remark #177" with /W4. That doesn't fit the
3
1737
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 defined and it builds ok with no errors but im trying to get rid of the
0
8265
marktang
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...
0
8705
Oralloy
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...
0
8637
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8364
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,...
0
8504
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 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...
0
7193
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
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...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1511
bsmnconsultancy
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...

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.