On Wed, Oct 29, 2008 at 10:13 PM, Jorge Peixoto de Morais Neto <[EMAIL PROTECTED]> wrote: > The real problem is when you type > float real_number = 4e10; > int integer = real_number; > If your integer can only hold values up to 2^31 - 1 , the behavior of > the above code is undefined. > In a language like Python, everything either behaves as you intended, > of throws an exception. > This is why I say "In C, you must completely understand the behavior > of every statement or function, and you *must* handle the possibility > of errors".
The line: int integer = real_number; will produce a warning. (or an error if you are smart enough to compile with -Werror) But, if you know that the real number will be small enough and you don't mind getting the floor of the float, you may wish to ignore the error. Like mr McKinnon said, c will allow you to do wrong things. Depending on what you are doing, the babysitting of python, may or may not be a problem. One thing I would like to know (not knowing python that well), is when you make an error in python, when will the exception be thrown? At the start of run-time, or when the guilty code is encountered? And what if that code is in a codebranch that gets executed 0.0005% of the time? Regards Dirk