[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about Data type in VB.NET




I am hoping you could help me out with a question. 

In VB.NET if we declare an int by default from what I understand it is a 32 bit int size ranges from -2,147,483,648 through 2,147,483,647. The size range for short however is -32,768 through 32,767 and char is 0 through 65535 (unsigned) (msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vagrpdatatype.asp). 

1) So if one is writing a network application in vb.net and has to declare a variable port, should they be declaring the port# as char?

2) What would happen if they declared it as an int. Since vb.net has no buffer overflows would that mean if someone forced to go outside the range of port numbers there would be a possible runtime error and that is all?

3) What happens if one for optimization purposes "Remove Integer Overflow Checks" while compiling would this lead to a buffer overflow in vb code?

Thanks

DK