• 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: __builtin_constant_p fails for Intel compilation?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: __builtin_constant_p fails for Intel compilation?


  • Subject: Re: __builtin_constant_p fails for Intel compilation?
  • From: Eric Albert <email@hidden>
  • Date: Thu, 12 Jan 2006 10:55:22 -0800

On Jan 12, 2006, at 7:22 AM, Alexey Proskuryakov wrote:

In our project, we've been using macros from Endian.h, but now it appears
that they don't quite work for Intel. Using "Carbon Application" stationery:


#include <Carbon/Carbon.h>

enum {
    kMyConst1 = EndianU32_NtoB(0),
    kMyConst0 = EndianU32_NtoB('1234')
};

/Users/ap/Desktop/Endian/main.cpp:5: error: 'uint32_t
_OSSwapInt32(uint32_t)' cannot appear in a constant-expression
/Users/ap/Desktop/Endian/main.cpp:5: error: a function call cannot appear in
a constant-expression
/Users/ap/Desktop/Endian/main.cpp:6: error: 'uint32_t
_OSSwapInt32(uint32_t)' cannot appear in a constant-expression
/Users/ap/Desktop/Endian/main.cpp:6: error: a function call cannot appear in
a constant-expression


Looking at the macro definitions, I suppose that it is
__builtin_constant_p that fails here. I'm using Xcode 2.2. Is it a bug, or
I'm just doing something wrong?

__builtin_constant_p sadly isn't sufficiently smart to realize that this expression is constant. We already have a bug on this, but you may want to file another one to raise the visibility of the first one.


That said, if you switch from EndianU32_NtoB to OSSwapConstInt32HostToBig this'll work fine.

Hope this helps,
Eric

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


  • Follow-Ups:
    • Re: __builtin_constant_p fails for Intel compilation?
      • From: Alexey Proskuryakov <email@hidden>
References: 
 >__builtin_constant_p fails for Intel compilation? (From: Alexey Proskuryakov <email@hidden>)

  • Prev by Date: Re: Just when does an application commit to PowerPC vs. Intel?
  • Next by Date: Re: Problem after upgrade
  • Previous by thread: __builtin_constant_p fails for Intel compilation?
  • Next by thread: Re: __builtin_constant_p fails for Intel compilation?
  • Index(es):
    • Date
    • Thread