Re: is order urgent doubt
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Mon, 02 Jun 2008 16:15:24 -0700
new to c <non@xxxxxxxxxxxx> writes:
Keith Thompson wrote:[...]
[...]Please post a small complete program that exhibits the problem.
Copy-and-paste the entire exact program; don't re-type it or summarize
it. Show us the compiler's warnings and the program's output
(copy-and-paste them as well).
I use wedit IDE.
According to what I've been able to find from a quick Google search,
wedit is an IDE that can be configured to work with different
compilers. Which *compiler* are you using? (I don't recognize the
layout of the warning messages.)
I write this code :
#include <stdio.h>
int main(void)
{
int i;
i = sizeof(long int);
printf("sizeof(long int): %d\n", i);
i = sizeof(int long);
printf("sizeof(int long): %d\n", i);
i = sizeof(double int);
printf("sizeof(double int): %d\n", i);
i = sizeof(int double);
printf("sizeof(int double): %d\n", i);
i = sizeof(long long int);
printf("sizeof(long long int): %d\n", i);
i = sizeof(long int long);
printf("sizeof(long int long): %d\n", i);
i = sizeof(int long long);
printf("sizeof(int long long): %d\n", i);
return 0;
}
Compiler warn
Warning c:\New_Folder\Test.c: 3 old-style definition for 'main'
Warning c:\New_Folder\Test.c: 3 missing prototype for 'main'
That's just plain wrong. "int main(void)" is a prototype, not an
old-style definition. I'm quite surprised that any compiler would get
this wrong. Are you *sure* that the code you posted is the same as
the code the compiler is seeing? Maybe the IDE is causing confusion
about the code in the editor vs. the code in the source file.
Try inserting a single blank line at the very top of the file and
recompiling. It should change the line numbers in the warning
messages and have no other effect. If you do this experiment, don't
bother posting the full results; just let us know whether it behaves
as I described. If so, it tends to confirm that the compiler is
really seeing the code that you posted.
Warning c:\New_Folder\Test.c: 12 multiple use of 'int'
For "double int". A diagnostic is required, but the compiler is
confused.
Warning c:\New_Folder\Test.c: 15 multiple use of 'double'
For "int double". See above.
Warning c:\New_Folder\Test.c: 21 multiple use of 'long'
This is for "long int long". It would be reasonable if it were a C90
compiler that doesn't accept long long, but it didn't complain about
"long long int" 3 lines up.
Warning c:\New_Folder\Test.c: 24 multiple use of 'longlong'
And that's just silly. Perhaps "longlong" is some internal name that
leaked out into the warning message.
[snip]
It looks like you've got a seriously buggy compiler on your hands,
though it might be able to handle code that's carefully written to
avoid its shortcomings. We still don't know which compiler it is. If
you can find out, see if there's a newer version.
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.
- Follow-Ups:
- Re: is order urgent doubt
- From: Ben Bacarisse
- Re: is order urgent doubt
- References:
- is order urgent doubt
- From: new to c
- Re: is order urgent doubt
- From: Keith Thompson
- Re: is order urgent doubt
- From: new to c
- Re: is order urgent doubt
- From: Bartc
- Re: is order urgent doubt
- From: new to c
- Re: is order urgent doubt
- From: Keith Thompson
- Re: is order urgent doubt
- From: new to c
- is order urgent doubt
- Prev by Date: Re: Parameter order for Struct
- Next by Date: Re: How to print an array of char backward.
- Previous by thread: Re: is order urgent doubt
- Next by thread: Re: is order urgent doubt
- Index(es):
Relevant Pages
|