Talk:Parse an IP Address: Difference between revisions

→‎Sloppy: Ah, understood.
mNo edit summary
(→‎Sloppy: Ah, understood.)
Line 32:
:::: How would it be any different from a console-output-capable language that wasn't C? --[[User:Short Circuit|Michael Mol]] 15:50, 28 September 2011 (UTC)
::::: In languages which have variable length tuples as a native type(like Pico Lisp) returning a port number or omitting a port number is trivial. You can either return (addr-family ip-address port) or (addr-family ip-address). In a language like C, it's much more natural to use something like a struct with a fixed memory layout. Of course, whether this issue propagates to a textual representation of the result is a different issue... But currently the task is asking for a result and a textual representation of that result would be for illustrative purposes. --[[User:Rdm|Rdm]] 16:21, 28 September 2011 (UTC)
:::::: So the "In languages where variant result types are clumsy" bit is about how an example represents data internally, then. I think I understand, then. Not certain it's necessary, though. In answer to your question, the address would probably be represented using something like a [http://msdn.microsoft.com/en-us/library/windows/desktop/ms737530(v=VS.85).aspx sockaddr] structure.--[[User:Short Circuit|Michael Mol]] 16:48, 28 September 2011 (UTC)