bluesky idea: __attribute__ (netorder)

Jamie Lokier
Sun Sep 6 18:57:00 GMT 1998

On Sun, Sep 06, 1998 at 11:02:13AM -0400, Tim Hollebeek wrote:
> You mean instead of variables just having values, they also have types?
> What a novel concept.

You noticed.. ;-)

> There are hundreds of ways to do this that do not include modifying
> the compiler and writing nonstandard C/C++.  For example:
[struct wrappers]

Indeed, the Linux kernel uses this technique in some places to catch
type errors.

The attribute thoughts were to do with warning about errors in network
code that uses standard types and functions.  But thinking about it, to
avoid warnings you'd need as many changes in the application code as for
your struct wrappers.  (I.e., none if all you do is
`addr.sin_port = htons (port)' etc.; sometimes more).

Consider anything I said on this topic withdrawn, stomped upon,
dismissed, discarded etc.

-- Jamie

More information about the Gcc mailing list