A 'lazy' compilation mode to make writting multiplatform code easier without having to clutter the project

ryuukk_ ryuukk.dev at gmail.com
Wed Feb 22 15:08:41 UTC 2023


On Wednesday, 22 February 2023 at 14:39:41 UTC, jmh530 wrote:
> On Wednesday, 22 February 2023 at 14:23:09 UTC, ryuukk_ wrote:
>> Hello,
>>
>> My project is kinda special, i am targeting all 3 major 
>> desktop OS's as well as the web with WebAssembly
>>
>> [snip]
>>
>> Compiler should know that if i am on windows, when i call 
>> ``poll()`` it'll only ever call ``poll_windows()``, why fetch 
>> ``import posix = ..;``and compile ``poll_posix()``?
>>
>> [snip]
>
> If poll_posix is made private, is the compiler smart enough to 
> optimize it away on Windows?

It does, but not if inside i call functions from a posix specific 
import, i get: ``Error: undefined identifier`` even thought it's 
never called


More information about the Digitalmars-d mailing list