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

Re: Is this OK in C++ and C?



01.01.2013 22:11, Zbigniew Komarnicki kirjoitti:
> I was very surprised when I discover that this code was compiled 
> without any warning. I thought if a variable is 'unsigned int'  
> then this is not allowed to assign negative value.
> That's all. 
Indeed that is all. C and C++ are light weight code generators, and most
such checks must be coded, they are not generated by the compiler. There
are other languages, like Ada, and Pascal too, being more pedantic for
such issues. But they generate usually more bloated code, as the
compiler just creates the checks into it.

-- 

Q:	"What is the burning question on the mind of every dyslexic
	existentialist?"
A:	"Is there a dog?"


Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: