"Strong typing vs. strong testing"

Pascal Bourguignon pjb at invitado-174.medicalis.es
Thu Sep 30 09:14:36 EDT 2010


TheFlyingDutchman <zzbbaadd at aol.com> writes:

> In this example RG is passing a long literal greater than INT_MAX to a
> function that takes an int and the compiler apparently didn't give a
> warning about the change in value as it created the cast to an int,
> even with the option -Wall (all warnings). I think it's legitmate to
> consider that an option for a warning/error on this condition should
> be available. As far the compiler generating code that checks for a
> change in value at runtime when a number is cast to a smaller data
> type, I think that's also a legitimate request for a C compiler option
> (in addition to other runtime check options like array subscript out
> of bounds).

I think that it's a legitimate request, in this age and day, for a C
programmer to require that it be NOT an option to a C compiler not to
give any error for this and similar cases.

(And we should just kill all the programs that don't pass this check,
which I'm afraid would be a big number, which I understand, is the
reason why C compilers don't change).

-- 
__Pascal Bourguignon__
http://www.informatimago.com



More information about the Python-list mailing list