Click here to Skip to main content
15,910,872 members
Home / Discussions / C#
   

C#

 
GeneralRe: The usage of Unsigned types Pin
PIEBALDconsult26-Mar-15 5:52
mvePIEBALDconsult26-Mar-15 5:52 
AnswerRe: The usage of Unsigned types PinPopular
Richard Deeming26-Mar-15 6:02
mveRichard Deeming26-Mar-15 6:02 
AnswerRe: The usage of Unsigned types Pin
OriginalGriff26-Mar-15 6:05
mveOriginalGriff26-Mar-15 6:05 
AnswerRe: The usage of Unsigned types Pin
Sascha Lefèvre26-Mar-15 6:09
professionalSascha Lefèvre26-Mar-15 6:09 
GeneralRe: The usage of Unsigned types Pin
harold aptroot26-Mar-15 22:41
harold aptroot26-Mar-15 22:41 
GeneralRe: The usage of Unsigned types Pin
GerVenson26-Mar-15 23:40
professionalGerVenson26-Mar-15 23:40 
GeneralRe: The usage of Unsigned types Pin
harold aptroot26-Mar-15 23:45
harold aptroot26-Mar-15 23:45 
AnswerRe: The usage of Unsigned types Pin
den2k8826-Mar-15 22:55
professionalden2k8826-Mar-15 22:55 
Jean-Pierre Bachmann wrote:
Don't mention that the uint takes less memory but this is not the point.

uint does not take less memory than a int, they have the same exact size - it changes only the representation from pure binary to 2's complement.

Integers are the basic echange unit in the system, they allow checking for overflows and underflows: if you use a ushort in a port number and have something bad that wraps around you won't get a negative number but a perfectly valid port number. If you'd have something that overflows you would still get a perfectly valid port number.

Unless you have to store/send 2 bytes values in some form of structure or have to make bit operations on 16bit wide operands there is no real need of shorts - and if you don't have to convert decimal values in 16 bits values you won't need unsigned versions of it either since math operations yields off the same binary signature. Even if you should read a decimal value and convert it in a 0-65535 range it would be better to use an int as a middle step because there may be the possibility of reading a greater number.

These are my reasons, stemmed from my experience of course.
Geek code v 3.12
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- r++>+++ y+++*
Weapons extension: ma- k++ F+2 X


I use 1TBS

AnswerRe: The usage of Unsigned types Pin
jschell27-Mar-15 11:15
jschell27-Mar-15 11:15 
QuestionCombobox and "autocompletion" Pin
TMattC26-Mar-15 0:18
TMattC26-Mar-15 0:18 
AnswerRe: Combobox and "autocompletion" Pin
TMattC26-Mar-15 0:23
TMattC26-Mar-15 0:23 
AnswerRe: Combobox and "autocompletion" Pin
Simon_Whale26-Mar-15 1:29
Simon_Whale26-Mar-15 1:29 
GeneralRe: Combobox and "autocompletion" Pin
TMattC26-Mar-15 4:38
TMattC26-Mar-15 4:38 
Questionadd PDF file to email body not an attachment Pin
sourabkhajuria25-Mar-15 23:49
sourabkhajuria25-Mar-15 23:49 
AnswerRe: add PDF file to email body not an attachment Pin
OriginalGriff25-Mar-15 23:53
mveOriginalGriff25-Mar-15 23:53 
AnswerRe: add PDF file to email body not an attachment Pin
Dave Kreskowiak26-Mar-15 1:27
mveDave Kreskowiak26-Mar-15 1:27 
QuestionUnderstanding Async / Await Pin
zephaneas25-Mar-15 10:07
zephaneas25-Mar-15 10:07 
AnswerRe: Understanding Async / Await Pin
F-ES Sitecore25-Mar-15 12:23
professionalF-ES Sitecore25-Mar-15 12:23 
SuggestionRe: Understanding Async / Await Pin
Richard Deeming26-Mar-15 2:57
mveRichard Deeming26-Mar-15 2:57 
QuestionUse EPPlus to Read 1st Column Of Excel Workbook Into Array (.xlsx) Pin
Hellfire123125-Mar-15 4:42
Hellfire123125-Mar-15 4:42 
AnswerRe: Use EPPlus to Read 1st Column Of Excel Workbook Into Array (.xlsx) Pin
OriginalGriff25-Mar-15 5:25
mveOriginalGriff25-Mar-15 5:25 
QuestionEffective way of writing logs in web service in C#.net Pin
manishchourasia200025-Mar-15 0:19
professionalmanishchourasia200025-Mar-15 0:19 
AnswerRe: Effective way of writing logs in web service in C#.net Pin
Elegantly Wasted25-Mar-15 0:51
Elegantly Wasted25-Mar-15 0:51 
AnswerRe: Effective way of writing logs in web service in C#.net Pin
jschell25-Mar-15 11:28
jschell25-Mar-15 11:28 
QuestionCould not cal the repaint on invalidate Pin
Sarita S24-Mar-15 22:54
Sarita S24-Mar-15 22:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.