You receive an "Overflow" error if you use -9223372036854775808 (Long.MinValue) in Visual Basic .NET or in Visual Basic 2005 (820657)
The information in this article applies to:
- Microsoft Visual Basic 2005
- Microsoft Visual Basic .NET (2003)
- Microsoft Visual Basic .NET (2002)
SYMPTOMSIf you use -9223372036854775808 for the minimum value of the Long data type in your Microsoft
Visual Basic .NET or Microsoft Visual Basic 2005 application, you cannot build your application, and you
receive the following error message: Overflow. CAUSEThis problem occurs because Microsoft Visual Basic .NET, Microsoft Visual Basic 2005, Microsoft Visual C# 2005, and
Microsoft Visual C# .NET have syntactic grammar that does not include the
leading hyphen (-) as part of the numeric literal. The parser reads the numeric part, and then the parser applies the unary
minus (-) operator to the number.
Your Visual Basic .NET application parses the minimum value of
the Long data type as 9223372036854775808. This number is greater than maximum value for the Long data
type. Therefore, you receive the error message mentioned in the "Symptoms"
section of this article.
Note The problem only occurs in Visual Basic .NET or in Visual Basic 2005, because Visual C#
.NET or Visual C# 2005 has a rule for the numeric type hyphen prefix.
WORKAROUNDTo work around the problem, use one of the following
procedures:
STATUS This
behavior is by design.REFERENCES For
additional information, click the following article number to view the article
in the Microsoft Knowledge Base: 811402
Microsoft Visual Basic .NET Parser Incorrectly Evaluates the Data Type If the Minimum Value of the Numeric Data Types Is Parsed
Modification Type: | Minor | Last Reviewed: | 10/3/2006 |
---|
Keywords: | kbvs2005applies kbvs2005swept kbCompiler kbprb KB820657 kbAudDeveloper |
---|
|