Problem parsing IPv4/IPv6 addresses with std.socket.parseAddress

Dsciple via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 28 10:11:04 PDT 2016


On Wednesday, 28 September 2016 at 16:49:54 UTC, Vladimir 
Panteleev wrote:
> On Wednesday, 28 September 2016 at 15:34:56 UTC, Dsciple wrote:
>> I don't understand what prevents such function (in turn 
>> calling some OS-level C function) from doing its job at 
>> compile time too. Guess it's a very challanging thing to do at 
>> compile-time, or should I open an issue with the std.socket 
>> lib developers?
>
> std.socket simply passes the request on to the operating 
> system. Enabling parsing IP addresses at compile time would 
> necessitate duplicating the logic already present in the 
> operating system libraries, which would not be future-proof at 
> best, and buggy at worst.
>
> It's not possible to implement by invoking C functions like at 
> runtime, since that is forbidden during compile-time for a 
> number of reasons, mainly safety.

I suspected there must have been a very good reason for this not 
being possible at compile time and this definitely looks like 
one: thanks Vladimir for tracking this discussion and clarifying 
it to me!
So I guess this answers all my questions and. as a beginner, I 
can also say I learned something in the process: thank you again!



More information about the Digitalmars-d-learn mailing list