Index | Thread | Search

From:
Mark Kettenis <mark.kettenis@xs4all.nl>
Subject:
Re: Cruft: drop htonl() etc. from libc
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
guenther@gmail.com, kernigh@gmail.com, tech@openbsd.org
Date:
Sat, 13 Apr 2024 11:27:48 +0200

Download raw body.

Thread
  • Claudio Jeker:

    Cruft: drop htonl() etc. from libc

  • > Date: Sat, 13 Apr 2024 02:15:33 +0200
    > From: Christian Weisgerber <naddy@mips.inka.de>
    > 
    > Philip Guenther:
    > 
    > > > I believe that macros like htonl don't need functions, but this
    > > > diff is correct to keep a function which already exists.
    > > 
    > > Unless explicitly specified as a macro, POSIX requires all functional
    > > interfaces to have a function prototype and external symbol.
    > 
    > We only have htonl() etc. as macros and that is permitted by POSIX:
    > "On some implementations, these functions are defined as macros."
    > 
    > We don't have any prototype for htonl() in our headers.
    > 
    > If you want to get at the functions in libc, you need to #undef
    > htonl (or avoid including any headers that pull in the macro), and
    > provide your own prototype.
    > 
    > Importantly, my proposed diff doesn't change any of that.
    
    And that is the right approach I think.
    
    
    
  • Claudio Jeker:

    Cruft: drop htonl() etc. from libc