In VB.NET, you can declare a literal datatype by added various characters at the end of a value, such as 100L for Int64, 100UL for UInt64, 100S for Int16, etc...
This can be used to implicitly set a variable (similar to C# var):
Dim s = -32767S 'this is now implicitly an Int16
However, for Int16, if I want the minimum value of -32768, this flags as an overflow error:
Dim s = -32768S '<-- this will be flagged as an overflow error
Yet, I can do this:
Dim s = Int16.MinValue '<-- this is also -32768S, just without the overflow error
I can always use an Int32 and it will automatically convert if I declare the variable as an Int16:
Dim s As Int16 = -32768 '<-- no overflow because -32768 is an Int32
I tried googling for a reason that -32768S was excluded from the literal set, but could not find an answer. Just curious if anyone knows of a reason/backstory as to how this happened.