• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: long Tigers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: long Tigers


  • Subject: Re: long Tigers
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Fri, 13 May 2005 20:41:30 +0200


On 13.05.2005, at 13:27, Clark Cox wrote:

On 5/13/05, Gerriet M. Denkmann <email@hidden> wrote:
Tiger has cleaned up some definitions. This is a good thing. But it
confuses my compilers.

E.g. in /usr/include/mach-o/loader.h
Panther:
struct mach_header {
        unsigned long   magic;
... }

Tiger:
struct mach_header {
        uint32_t        magic;
... }

When I have:
fprintf( stderr, "magic %#x\n", __FUNCTION__, head1->magic);
the Panther compiler rightly complains: "unsigned int format, long
unsinged int arg".

And when I switch to "%#lx" the Tiger compiler says: "format "%#lx
expects 'long unsigned int' but argument has type 'uint32_t'"

What is the clever way to make it compile both on Panther and Tiger
without switching the warning off? And preferably without hundreds of
#ifdefs.

This should be correct on both platforms (make sure to #include <inttypes.h>):


fprintf( stderr, "magic %#"PRIx32"\n", (uint32_t)head1->magic);

Well, it works even without inttypes.h: fprintf( stderr, "magic %#x\n", (uint32_t)head1->magic);

Gerriet.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: long Tigers
      • From: Clark Cox <email@hidden>
References: 
 >long Tigers (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: long Tigers (From: Clark Cox <email@hidden>)

  • Prev by Date: Re: Where/how to store lots of user application data
  • Next by Date: Re: long Tigers
  • Previous by thread: Re: long Tigers
  • Next by thread: Re: long Tigers
  • Index(es):
    • Date
    • Thread