[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in Guile's Posix Networking
From: |
Ken Raeburn |
Subject: |
Re: Bug in Guile's Posix Networking |
Date: |
Sun, 13 Feb 2011 13:34:59 -0500 |
On Feb 13, 2011, at 08:55, Noah Lavine wrote:
> OS X, which I use, has a somewhat weird field-naming situation. The
> generic sockaddr structure has sa_len, but sockaddr_in has a sin_len
> field.
No, that's normal for a traditional C/UNIX API. Each structure's field names
use a prefix that's an abbreviation for the struct type. So sockaddr_in uses
sin_ and not sa_.
If this were a pure C++ API we'd have inheritance and could just specify a
length field in the base class "sockaddr" from which the others might be
derived. But for this ancient C/UNIX API, we have different structures with
different field names, and must cast the pointers.
> The code I was fixing is creating a sockaddr_in, so in order to
> use the sa_len field I would have had to cast a sockaddr_in to a
> sockaddr, and it just seemed cleaner to use the sin_len field. It's no
> big deal either way, though - this would affect probably 10 or fewer
> lines of code no matter what.
Yes, that's fine; just ditch the test for sockaddr (no _in) having a sin_len
field.
Ken
- Re: Bug in Guile's Posix Networking, (continued)
- Re: Bug in Guile's Posix Networking, Andy Wingo, 2011/02/12
- Re: Bug in Guile's Posix Networking, Noah Lavine, 2011/02/12
- Re: Bug in Guile's Posix Networking, Andy Wingo, 2011/02/12
- Re: Bug in Guile's Posix Networking, Noah Lavine, 2011/02/12
- Re: Bug in Guile's Posix Networking, Noah Lavine, 2011/02/12
- Re: Bug in Guile's Posix Networking, Noah Lavine, 2011/02/12
- Re: Bug in Guile's Posix Networking, Noah Lavine, 2011/02/12
- Re: Bug in Guile's Posix Networking, Ken Raeburn, 2011/02/13
- Re: Bug in Guile's Posix Networking, Noah Lavine, 2011/02/13
- Re: Bug in Guile's Posix Networking, Noah Lavine, 2011/02/13
- Re: Bug in Guile's Posix Networking,
Ken Raeburn <=
- Re: Bug in Guile's Posix Networking, Andy Wingo, 2011/02/13
- Re: Bug in Guile's Posix Networking, Noah Lavine, 2011/02/13
- Re: Bug in Guile's Posix Networking, Noah Lavine, 2011/02/13
- Re: Bug in Guile's Posix Networking, Andy Wingo, 2011/02/13
- Re: Bug in Guile's Posix Networking, Andy Wingo, 2011/02/13
Re: Bug in Guile's Posix Networking, Andy Wingo, 2011/02/12