[Development] better compile-time os detection

EXT Tim Blechmann tim.blechmann at qt.io
Tue Jul 21 11:42:29 CEST 2026


>> D: separate "OS" from "OS family"
>> if we introduce a concept of "OS family", one could group, e.g. linux,
>> android, ohos as one "linux family", like one could treat
>> ios/ipados/visionos/tvos/watchos as "ios family"
> 
> For reference, the "ios family" is called Darwin and we already have a
> define for that.  So this has a precedent.
the "ios family" would/could map to all apple operating systems other 
than macos: they often tend to have very similar APIs that are distinct 
to "macos", e.g. AppKit is MacOS only, while the iOS family has UIKit. 
darwin also refers more to the os kernel, so one could argue:

so something along the lines of:
```
struct Unix_t{};
struct Darwin_t : Unix_t{};
struct MacOS_t : Darwin_t{};
struct iOSFamily_t : Darwin_t{};
struct iOS_t : iOSFamily_t{};
struct iPadOS_t : iOSFamily_t{};
struct iTvOS_t : iOSFamily_t{};
```

technically "darwin" could also refer to other darwin-based systems that 
are based on the open-source darwin stack ...



More information about the Development mailing list