On Thursday, 23 July 2026 19:20:41 Pacific Daylight Time EXT Tim Blechmann via
Development wrote:
> depending on the code, one could utilize tag dispatching, so only then
> overload declarations would require the preprocessor.
> ```
> #ifdef LINUX
> auto rename(auto src, auto target, Os::LinuxT) {
> return renameat2(...);
> }
> #elif DARWIN
> auto rename(auto src, auto target, Os::DarwinT) {
> return renameatx_np(...);
> }
> #endif
>
> auto rename(auto src, auto target)
> {
> return rename(src, target, Os::Current); // no ifdef
> }
> ```Why would you do that? What's the advantage? If you remove the tag, it would compile to the same thing. > it is mainly useful for cases where no platform-specific APIs are > involved, but one still wants to do per-platform decisions. Right, things like "does this platform use .so suffix or .dylib?" Those aren't detections, they are defaults we apply. -- Thiago Macieira - thiago.macieira (AT) intel.com Principal Engineer - Intel DCG - Platform & Sys. Eng.
smime.p7s
Description: S/MIME cryptographic signature
-- Development mailing list [email protected] https://lists.qt-project.org/listinfo/development
