mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: printf POSIX compliance
Date: Sat, 9 Jun 2012 14:58:55 +0200	[thread overview]
Message-ID: <20120609125854.GC17860@port70.net> (raw)
In-Reply-To: <20120609024556.GY163@brightrain.aerifal.cx>

* Rich Felker <dalias@aerifal.cx> [2012-06-08 22:45:56 -0400]:
> On Fri, Jun 08, 2012 at 07:33:57PM -0700, Isaac Dunham wrote:
> > Of course, I know this isn't the right place to discuss such
> > things--that would be for gnulib. 
> 
> Actually I don't think it's very off-topic here. This is certainly a
> major affected community that has an interest in solving the problem,
> and Reuben seems familiar with gnulib and the developer community and
> interested in helping us find solutions and get them integrated. What
> is the next step we should take? Posting to the gnulib mailing list or
> bug tracker, or contacting somebody directly?
> 

i don't like the gnulib approach to portability

1) it implements broken functions which simply must not
be used in an application with portability requirements
(eg alloca is implemented using assumptions about the
stack mechanism and invokes undefined behaviour)

2) instead of sharing code between platforms they use ifdefs
and depend on internals of the implementation
(eg. broken gnu stdio functions: gnulib will never work on
a new platform out of the box, you have to port it whenever
there is a new libc or even a new version of a libc)

3) they duplicate a lot of the libc writing effort
and provide bad quality code
(eg. math functions: a mathematical software will only be
portable if libm is high quality so if portability matters
you need a libm written in portable c code (and maybe even
softfloat emulation)

for non-mathematical software probably a simple naive
implementation is ok, but again it could be a separate
'libmdummy' written in clean ansi c and it could be used
everywhere, so the same code gets tested on all platforms

what gnulib gives you is mostly dummy functions with
inconsistent quality, randomly pulled in depending on the
target platform which means math code with gnulib can easily
explode whenever high accuracy, correct nan handling or fenv
support is required)


in my opinion the more correct approaches to portability are

1) have a high quality libc (like musl) and port it
to all the required targets (eg by emulating syscalls)

2) write the application with portability in mind: instead
of using posix api use a 'libportability' api that covers
enough areas so the application can work and simple enough
so it can be implemented on any target (so eg. it has no
alloca and freadahead in it, and only has limited form of
networking, process or file management etc)

these approaches are scalable because the platform specific
code is minimized
(the difficult part of the code is the same on all platforms)


  reply	other threads:[~2012-06-09 12:58 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-08 10:34 Reuben Thomas
2012-06-08 12:19 ` Luca Barbato
2012-06-08 12:32   ` Reuben Thomas
2012-06-08 14:04 ` Szabolcs Nagy
2012-06-08 14:16   ` Rich Felker
2012-06-08 14:44 ` Rich Felker
2012-06-08 14:55   ` Rich Felker
2012-06-08 15:06     ` Szabolcs Nagy
2012-06-08 15:29       ` Rich Felker
2012-06-08 15:43         ` Reuben Thomas
2012-06-08 15:53           ` Rich Felker
2012-06-08 16:16             ` Reuben Thomas
2012-06-08 16:38               ` John Spencer
2012-06-08 16:37                 ` Reuben Thomas
2012-06-09  7:43                   ` John Spencer
2012-06-09 14:17                     ` Reuben Thomas
2012-06-08 16:46       ` John Spencer
2012-06-08 16:46         ` Reuben Thomas
2012-06-08 16:51           ` Rich Felker
2012-06-08 16:58             ` Reuben Thomas
2012-06-08 17:00           ` Rich Felker
2012-06-08 17:07             ` Reuben Thomas
2012-06-08 23:25               ` Rich Felker
2012-06-09  2:33           ` Isaac Dunham
2012-06-09  2:45             ` Rich Felker
2012-06-09 12:58               ` Szabolcs Nagy [this message]
2012-06-09 14:17                 ` Reuben Thomas
2012-06-09 21:11                 ` Rich Felker
2012-06-09 21:24                   ` Reuben Thomas
2012-06-09 14:15               ` Reuben Thomas
2012-06-11  9:37 Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120609125854.GC17860@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).