VB Compiler Warnings & other woes ...

R

rawCoder

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
 
G

Guest

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
 
R

Richard Myers

In Visual Basic .NET , your function definition might requirre you to
return
Surely it becomes very obvious when your function returns "Nothing". You do
"test" your code after you write it... right?

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.

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
 
G

Guest

looks like MS thinks you are wrong Richard

From vs2005 bv newsgroup post...

Subject: function return values
From: "[MS][email protected]" <[email protected]> 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.

(e-mail address removed)

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

..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top