Python for air traffic control?
Russ
18k11tm001 at sneakemail.com
Thu Jul 5 04:38:18 EDT 2001
Mirko Liss <mirko.liss at web.de> wrote in message news:<20010704013238.2DC8A00.NOFFLE at niccolo.ke4.de>...
> On 3 Jul 2001, Russ wrote:
>
> > Consider the type checking in C or C++, for example. Suppose that a
> > function takes several ints (or any other type) as arguments, and
> > suppose the calls of the function all pass ints in the correct slots.
> > The compiler will be perfectly happy. Does that assure that the
> > arguments are passed correctly? Of course not. It is a necessary but
> > not sufficient condition for correctness. The arguments could be
> > completely out of order, and the compiler wouldn't have a clue.
>
> If the arguments of a function are out of order, the compiler
> should bark and die, shouldn´t it?
Not if the order of the types is still the same. Suppose I pass (int
i, int j, int k) when I should have passed (int k, int j, int i). You
get the idea.
> Most programmers use type definitions deliberately, just to provoke
> that kind of compile-time errors.
>
> An example in C:
>
> typedef plane t int ; /* plane no */
> typedef lane t int ; /* lane no */
> typedef go down in pieces t bool ;
> go down in pieces t dispatch( plane t flightno, \
> lane t neigboring highway ) ;
>
> If the arguments get swapped, the compiler gets angry.
> Is this what you wanted to have in C ?
I thought the compiler treats all those those typdefs as just another
name for int, hence it won't work, but I could be wrong.
Russ
More information about the Python-list
mailing list