This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problems with evolving feature test macros?


On Sat, Mar 15, 2014 at 07:17:17PM -0700, Paul Eggert wrote:
> Christoph Hellwig wrote:
> >if I want to write a portable application having libc help me using
> >only APIs provided in a well defined standard is useful
> 
> In theory that argument makes sense, but in practice almost nobody
> writes strictly conforming applications because it's too much
> trouble and these applications would have to do without too many
> useful features and speedups.  Instead, portable applications tend
> to take an Autoconf-style approach, and accommodate themselves to
> whatever the platform has to offer.

The fact that this is widespread in practice doesn't mean it's
necessary or beneficial. In fact most bad coding practices seem to
spread mostly from people seeing bad examples and copying them
(often a matter of cargo-culting).

What portion of applications really benefit from using nonstandard
features is a good open question. This, combined with a study of which
nonstandard features are widely important (I'd wager MAP_ANONYMOUS is
one of the most widely needed) would in turn be very helpful to the
standards bodies for improving the standards.

>From an application or library standpoint, it's a lot EASIER to just
write your code to the standards and not have to worry about multiple
code paths selected by #ifdefs. It's easier to setup and maintain the
build system and easier to test the code (since you don't need to test
all combinations of HAVE_*'s). If there's extended functionality you
really really want/need to support when it's available, then yes you
have to take the more difficult option of detection (e.g. autoconf) or
manual configuration (aka hell) but I'd much rather be in the position
of not having to do either.

> For more about why strictly-conforming apps are rare, please see:
> 
> Walli SR. The myth of application source-code conformance.
> StandardView 1996;4(2);94â9. http://dx.doi.org/10.1145/234999.235002

Paywalled...

Rich


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]