> > Vincent Lefevre <[email protected]> wrote:
> > > Is there any reason why tcc hasn't rejected the code because the
> > > prototype wasn't declared?
> > 
> > Because C default declares functions for you. It's as if it was
> > declared
> > 
> >     int atan2(...);
>
> But I don't think that an implementation is disallowed to reject the
> code. As I read the standard, the library functions are specified only
> when the corresponding header is included. So, if the header is not
> included, the implementation could complain that it doesn't know the
> function.

C++ does reject the call. C is much more permissive. Try

$ cat > hello.c
int main() { printf("hello, world\n"); return 0; }
^D

Note that there's no include of <stdio.h>, yet the program compiles
and runs just fine, much as you'd expect it to.  Since K&R, when C
sees a call of a function which has not been declared, it treats as

        extern int foo(...);

I think, but am not sure, that C11 tightens this up.

Arnold

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to