This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -Wconversion not right (<32 bit problem)
- To: "J. Kean Johnston" <jkj at sco dot com>
- Subject: Re: -Wconversion not right (<32 bit problem)
- From: Jim Wilson <wilson at cygnus dot com>
- Date: Thu, 02 Oct 1997 22:02:28 -0700
- cc: EGCS Mailing List <egcs at cygnus dot com>, GCC2 Mailing List <gcc2 at cygnus dot com>
What -Wconversion is doing is telling you that the code has different
semantics with the prototype than it does without the prototype.
This does not mean the code is wrong.
What this means is if you started with K&R C code, and added a prototype,
and expected to get the same program, then you added the wrong prototype.
However, if you had ANSI C code all along, then the warning may not be
telling you anything useful.
Part of the problem here is that -Wconversion does two different things:
1) It emits warnings for ANSI C code using questionable constructs.
2) It emits warnings that are useful for people converting K&R C code to
ANSI C.
It was a historical error that the two different things got mixed together
in a single option.
Does this imply that even though I am passing a
16 bit quantity, a 32-bit quantity is pushed on the stack? If so this is
BAD news.
Yes, gcc does pass a 32-bit quantity, because that gives more efficient code,
and is compatible with how other x86 compilers work.
Pushing a 2 byte quantity to the stack is not very useful, because that would
cause the stack to become unaligned.
Most compilers work this way. Parameters are always passed as values which
are a multiple of the word size.
Jim