This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c/3112: printf error for structs with "long long" members
- To: Yu Di <ydi at eecs dot uic dot edu>
- Subject: Re: c/3112: printf error for structs with "long long" members
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Fri, 15 Jun 2001 10:31:23 +0100 (BST)
- cc: <gcc-bugs at gcc dot gnu dot org>, <gcc-gnats at gcc dot gnu dot org>, <zwei at eecs dot uic dot edu>
On Thu, 14 Jun 2001, Yu Di wrote:
> Hi, thanks for the reply, but I still have a question. I know "%lu" is not
> the correct format for "long long" variables, and that member will not get
> displayed correctly. But the question is: why the second struct member is
> also not displayed correctly?
As I said, read the Application Binary Interface (ABI) specification for
your system. You may find that longs take up four bytes of stack space
and long longs eight bytes, so if printf takes a long where you put a long
long, it will locate subsequent arguments incorrectly as well. Or there
may be some other calling convention with a similar effect.
--
Joseph S. Myers
jsm28@cam.ac.uk