• Welcome to Valhalla Legends Archive.
 

[VB.NET] Signed/Unsigned Data Types?

Started by BaDDBLooD, February 06, 2005, 12:37 PM

Previous topic - Next topic

BaDDBLooD

How do i make a Unsigned 32 Bit Integer?
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

shout


MyndFyre

Visual Basic .NET does not support the use of unsigned data types.  You can keep track of an instance of System.UInt32, but you cannot assign it an unsigned value (that is, a value greater than  System.In32.MaxValue).
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

dxoigmn


BaDDBLooD



        Public Overridable Overloads Sub InsertByte(ByVal b As Byte)
            Stream.WriteByte(b)
        End Sub

        Public Overloads Sub InsertByte(ByVal b As SByte)
            Stream.WriteByte(b)
        End Sub



I am trying to Overload my InsertByte function depending on the value given.. it is not working -_-
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

MyndFyre

Quote from: BaDDBLooD on February 06, 2005, 02:24 PM


        Public Overridable Overloads Sub InsertByte(ByVal b As Byte)
            Stream.WriteByte(b)
        End Sub

        Public Overloads Sub InsertByte(ByVal b As SByte)
            Stream.WriteByte(b)
        End Sub



I am trying to Overload my InsertByte function depending on the value given.. it is not working -_-

Okay, [edit]: Unsigned integral values 16 bits and larger are not supported in Visual Basic .NET.  Signed 8-bit values are not supported in Visual Baisc.  Therefore, the following types (which are not CLS-compliant) are not supported in Visual Basic .NET: SByte, UInt16, UInt32, UInt64.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

BaDDBLooD

Why do they exist? Are they "CLS Compliant" in framework 2.0?
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

dxoigmn

Quote from: BaDDBLooD on February 07, 2005, 03:14 PM
Why do they exist? Are they "CLS Compliant" in framework 2.0?

Yes.  UInteger, UShort, ULong.

MyndFyre

Quote from: dxoigmn on February 07, 2005, 03:53 PM
Quote from: BaDDBLooD on February 07, 2005, 03:14 PM
Why do they exist? Are they "CLS Compliant" in framework 2.0?

Yes.  UInteger, UShort, ULong.

I still don't think they're CLS-compliant; other things such as Generics, which will be available in 2.0 as well, are not CLS-compliant.

CLS-Compliant means that a particular language implements the very basic common components of the common language specification, which is the specification that allows the different languages to interoperate with one another.  A C# library that uses System.UInt32 inside of functions will work inside a Visual Basic .NET application.  However, if functions expose (such as a return value or accepted parameter) a non-CLS-compliant type, Visual Basic .NET will have trouble with it.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

dxoigmn

Quote from: MyndFyre on February 07, 2005, 04:57 PM
I still don't think they're CLS-compliant; other things such as Generics, which will be available in 2.0 as well, are not CLS-compliant.

CLS-Compliant means that a particular language implements the very basic common components of the common language specification, which is the specification that allows the different languages to interoperate with one another.  A C# library that uses System.UInt32 inside of functions will work inside a Visual Basic .NET application.  However, if functions expose (such as a return value or accepted parameter) a non-CLS-compliant type, Visual Basic .NET will have trouble with it.

Generics are CLS-compliant.  So are those types I explained above in 2.0

MyndFyre

Quote from: dxoigmn on February 07, 2005, 05:17 PM
Quote from: MyndFyre on February 07, 2005, 04:57 PM
I still don't think they're CLS-compliant; other things such as Generics, which will be available in 2.0 as well, are not CLS-compliant.

CLS-Compliant means that a particular language implements the very basic common components of the common language specification, which is the specification that allows the different languages to interoperate with one another.  A C# library that uses System.UInt32 inside of functions will work inside a Visual Basic .NET application.  However, if functions expose (such as a return value or accepted parameter) a non-CLS-compliant type, Visual Basic .NET will have trouble with it.

Generics are CLS-compliant.  So are those types I explained above in 2.0

Generics are not CLS-compliant.  See the namespace browser at http://www.dotnet2themax.com/dotNetBrowser/ShowType.aspx?asm=mscorlib&ns=System.Collections.Generic&type=Comparer{T}.  Note that the System.CLSComplianAttribute attribute is applied to the type, with the property IsCompliant as false.  For information on System.UInt32, see http://www.dotnet2themax.com/dotNetBrowser/ShowType.aspx?asm=mscorlib&ns=System&type=UInt32.

They are an extension to the Common Language Specification.  They *can* be supported by multiple languages in a common way -- and they are in 2.0 -- but they are not required to be.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

BaDDBLooD

so if i switch to 2.0, my problem would lessen?
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

shout


MyndFyre

Quote from: BaDDBLooD on February 07, 2005, 06:11 PM
so if i switch to 2.0, my problem would lessen?

You don't need to have those functions at all.  You're converting things such as my packet buffer class, correct?  Those functions wouldn't be available to you in VB.NET anyway; you can just skip over them.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

BaDDBLooD

#14
Quote from: MyndFyre on February 07, 2005, 06:48 PM
Quote from: BaDDBLooD on February 07, 2005, 06:11 PM
so if i switch to 2.0, my problem would lessen?

You don't need to have those functions at all.  You're converting things such as my packet buffer class, correct?  Those functions wouldn't be available to you in VB.NET anyway; you can just skip over them.

Buffer.CS, which i converted to vb, which i then combined with my old PacketBuffer.vb to make my new PacketBuffer.vb.

I Just thought having those options would be beneficial... but if i can't get it to work than oh well.

I Would have just used your Buffer.CS class by.. iteself, but i wanted to experience with making inherited classes.  I might add a C# project with some of your open source classes.  I don't know as of yet.  Having both C# and VB7 projects might be a good learning experience.  Unfortunately, all your classes are sort of... vague and tied together;  Which makes it EXTREMELY difficult to use one, or the other.
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.