In article <slrnia9cpd.2uqe.usenet-nos...@guild.seebs.net>, Seebs <usenet-nos...@seebs.net> wrote:
> On 2010-09-30, Lie Ryan <lie.1...@gmail.com> wrote: > > On 09/30/10 16:09, TheFlyingDutchman wrote: > >> Dynamic typed languages like Python fail in this case on "Never blows > >> up". > > > How do you define "Never blows up"? > > I would say "blow up" would be "raise an exception". > > > Personally, I'd consider maximum(8589934592, 1) returning 1 as a blow > > up, and of the worst kind since it passes silently. > > So run your compiler with a decent set of warning levels, and watch as > you are magically warned that you're passing an object of the wrong type. My code compiles with no warnings under gcc -Wall. > On any given system, one or the other is true: > > 1. The constant 8589934592 is of type int, and the function will > "work" -- will give that result. > 2. The constant is not of type int, and the compiler will warn you about > this if you ask. It would be nice if this were true, but my example clearly demonstrates that it is not. And if your response is to say that I should have used lint, then my response to that will be that because of the halting problem, for any static analyzer that you present, I can construct a program that either contains an error that either your analyzer will not catch, or for which it will generate a false positive. It just so happens that constructing such examples for standard C is very easy. rg -- http://mail.python.org/mailman/listinfo/python-list