We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Can I get a compiler warning if I accidentaly assign a signed int to an unsigned int variable ?
eg: unsigned int ui_par = 0 ; signed int si_par = -1 ;
Normally I would write something like: ui_par = (WORD) (MAX(0,si_par)) ;
But if I accidentally do the following: ui_par = si_par ; => ui_par = 65535 => no compiler warning ?
'C' is not a strongly-typed language, so compilers can't be relied upon to catch such mistakes - as they are not "errors" as far as the language is concerned.
Some compilers might give a warning, though. You'll have to check in the appropriate Manual.
You should use something like LINT to detect such mistakes, and/or use a strongly-typed language like Pascal...