Re: is order urgent doubt



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"
.



Relevant Pages

  • Re: Parameter Name Warning?
    ... the names on the declarations do not matter, it should perhaps give a warning regarding different names being used. ... > there is more to those names than just what the compiler does with them. ... > You know only what you get in the header. ... >>> int main ...
    (microsoft.public.vc.language)
  • Re: Whats the deal with size_t?
    ... ES> allowed to emit diagnostics that C doesn't require. ... in warning about a signed to unsigned conversion. ... a size_t to an int it is quite justified in warning about the reverse, ... The compiler is also quite justified in warning if you use a signed ...
    (comp.lang.c)
  • Re: Compendiums of compiler warning/error messages mapped to actual code problems?
    ... The general problem is of course that the compiler messages must be short, and that tends to make them so cryptic that it isn't always immediately obvious what the problem is. ... int this; ... Warning twarn.c: ...
    (comp.lang.c)
  • Re: matrix stuff (solving b = A*x) --> using numerical recipes
    ... but then I removed it since I couldn't see any compiler warnings/errors without stdio.h). ... turn the warning level up to the maximum ... void banmul(float **a, unsigned long n, int left, int right, float x, float b); ...
    (comp.lang.c)
  • Re: How do I create a function in my library for passing user callback function
    ... int my_callback_return; ... matches the declaration in the header file: ... in your source file, as well as any other functions that you have ... I'm surprised the compiler didn't get more upset. ...
    (comp.lang.c)