This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: c/3112: printf error for structs with "long long" members


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]