• 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: Clark Cox <email@hidden>
  • Date: Fri, 13 May 2005 15:46:47 -0400

On 5/13/05, Gerriet M. Denkmann <email@hidden> wrote:
>
> 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);

That assumes that (uint32_t) is a typedef for (unsigned int)


--
Clark S. Cox III
email@hidden
http://www.livejournal.com/users/clarkcox3/
http://homepage.mac.com/clarkcox3/
 _______________________________________________
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

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

  • Prev by Date: Runtime error: _NSAutoreleaseNoPool
  • Next by Date: Re: CoreData & NSTreeController question
  • Previous by thread: Re: long Tigers
  • Next by thread: Document Unreleased Only When Quitting
  • Index(es):
    • Date
    • Thread