[Development] Proposition for a new Q_OS_ define

Jake Thomas Petroules jake.petroules at petroules.com
Mon Mar 25 17:18:01 CET 2013


On Mar 25, 2013, at 5:11 AM, Sorvig Morten <Morten.Sorvig at digia.com> wrote:

> On Mar 23, 2013, at 1:51 AM, Jake Thomas Petroules <jake.petroules at petroules.com> wrote:
> 
>> I'd like to suggest that we add a new Q_OS_ define.
>> 
>> Currently, for Apple platforms, we have:
>> 
>> Q_OS_DARWIN
>> Q_OS_DARWIN32
>> Q_OS_DARWIN64
>> Q_OS_IOS
>> Q_OS_MAC
>> Q_OS_MAC32
>> Q_OS_MAC64
>> Q_OS_MACX
>> 
>> The first three are very straightforward. Q_OS_DARWIN is defined for both Apple platforms, OS X and iOS, with specific defines for 32 and 64 bit. iOS -- also straightforward; means iOS.
>> 
>> Then we get confusing. You'd think Q_OS_MAC is defined for OS X only, but it's just a synonym for Darwin, which makes it mostly useless. Further confusing is Q_OS_MACX which even more strongly implies that  it refers to OS X, but again it's simply a synonym for Darwin.
>> 
>> This results in a ton of #if defined(Q_OS_MAC) && !defined(Q_OS_IOS), which is very counterproductive. I propose that we add a Q_OS_OSX define (and Q_OS_OSX32 / Q_OS_OSX64) which is only defined for OS X. This would be quite helpful, I think.
>> 
>> Any objections? If not, dev or stable?
> 
> My initial thoughts are that the current situation is manageable and that "very counterproductive" is an overstatement. 
> 
> We recently started differentiating between "mac" and "macx" on the qmake level (d28073d9). A quick grep shows that "Q_OS_MACX" is currently used in two places in Qt (qsharedpointer.cpp and tst_qmlvisual.cpp). Re-purposing it to mean "OS X" only should be doable.
> 
> Morten


That sounds reasonable. I didn't know we could change the meaning of an existing ifdef, but it makes sense to be in line with the corresponding changes to qmake.
-- 
Jake Petroules
Chief Technology Officer
Petroules Corporation ยท www.petroules.com
Email: jake.petroules at petroules.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130325/1e32973c/attachment.html>


More information about the Development mailing list