Re: Doubt
- From: santosh <santosh.k83@xxxxxxxxx>
- Date: Thu, 31 Jul 2008 16:35:49 +0530
Anarki wrote:
On Jul 31, 3:44 pm, Ian Collins <ian-n...@xxxxxxxxxxx> wrote:
Anarki wrote:
int main(a,b,c,d,e,f,g)
{
printf("Size of a = %d\nSize of b =%d",sizeof(a),sizeof(b));
return 0;
}
The above program perfectly compiles in cygwin using gcc
and my questions are
1.How does the compiler know what are the types of variables a, b,
c, d, e, f and g?? Where is its declaration?
It's assuming they are int.
2.I haven't included stdio.h yet the printf compiles.The compiler
doesn't complain about the requirement of function prototype, why?
It does.
gcc /tmp/x.c
/tmp/x.c: In function 'main':
/tmp/x.c:3: warning: incompatible implicit declaration of built-in
function 'printf'
--
Ian Collins.
Please snip signatures unless you are commenting on them.
y no warning for me! ok if at all it complains how does this program
link with the printf? Does it look in default include files/libs ??
A compiler is allowed to do whatever it wants after emitting the
required diagnostics, including making guesses about what you meant and
trying to generate the best possible code.
By the way I use Cygwin(windows Xp) is there a way to redirect the
warning/errors to a text file. If so please tell me how
Use:
gcc -whatever_flags_you_want file_list_etc 2> errors.txt
Now all diagnostic messages will be redirected to a file named
errors.txt.
Using 2>> instead of 2> will append the output of the command to the
existing contents of errors.txt.
For more help ask in a Unix group like comp.unix.programmer or on the
mailing lists for Cygwin.
.
- Prev by Date: Re: x % y = ( x -(x/y) * y)
- Next by Date: Re: x % y = ( x -(x/y) * y)
- Previous by thread: Re: Doubt
- Next by thread: Re: Doubt
- Index(es):