>> I mean to really know C,
>> that is, read a rigorous book such as "C: A Reference Manual" and be
>> able to write portable programs with well-defined behavior. Speaking
>> of well-defined behavior, do you know what happens when you cast a
>> float to an int, and the float is too big to fit into the int?
>
> Did oyu try it yourself and see?
The point is that the behavior in this situation is "undefined". It
might do anything. Programming in C is different than programming in
Python.
In Python, you must know the basic behavior of a statement/functions.
If an error occurs, it raises an exception. If you do not catch the
exception, the program exits (and you can arrange for cleanup actions
to be performed before the program exits).
In C, you must know exactly what the statement/function does, and you
*must* handle the possibility of errors. If an error occurs and you do
not handle it, the program may crash, or it may go on and behave
erratically (such as deleting user files, or giving results subtly
wrong, or leaking memory, or...)
-- 
Software is like sex: it is better when it is free - Linus Torvalds

Reply via email to