[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Nevermind my previous comments. I just made an error.
From: |
Aharon Robbins |
Subject: |
Re: [Tinycc-devel] Nevermind my previous comments. I just made an error. |
Date: |
Mon, 11 Jan 2016 05:44:11 +0200 |
User-agent: |
Heirloom mailx 12.5 6/20/10 |
> > Vincent Lefevre <address@hidden> 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] Nevermind my previous comments. I just made an error., Ben Hutchinson, 2016/01/10
- Re: [Tinycc-devel] Nevermind my previous comments. I just made an error., Christian Jullien, 2016/01/10
- Re: [Tinycc-devel] Nevermind my previous comments. I just made an error., Vincent Lefevre, 2016/01/10
- Re: [Tinycc-devel] Nevermind my previous comments. I just made an error., arnold, 2016/01/10
- Re: [Tinycc-devel] Nevermind my previous comments. I just made an error., Vincent Lefevre, 2016/01/10
- Re: [Tinycc-devel] Nevermind my previous comments. I just made an error.,
Aharon Robbins <=
- Re: [Tinycc-devel] Nevermind my previous comments. I just made an error., Vincent Lefevre, 2016/01/11
- Re: [Tinycc-devel] Nevermind my previous comments. I just made an error., arnold, 2016/01/11
- Re: [Tinycc-devel] Nevermind my previous comments. I just made an error., Vincent Lefevre, 2016/01/12
- Re: [Tinycc-devel] Nevermind my previous comments. I just made an error., Edmund Grimley Evans, 2016/01/12
- Re: [Tinycc-devel] Nevermind my previous comments. I just made an error., Vincent Lefevre, 2016/01/12