From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: Re: Left-shift of negative number
Date: Sat, 18 Jul 2015 01:40:02 +0200 [thread overview]
Message-ID: <20150717234002.GA8664@port70.net> (raw)
In-Reply-To: <1437164614.30461.5.camel@inria.fr>
* Jens Gustedt <jens.gustedt@inria.fr> [2015-07-17 22:23:34 +0200]:
> Am Freitag, den 17.07.2015, 19:55 +0000 schrieb Pascal Cuoq:
> > I know that this is not well-known, so perhaps I should explain: ever since
> > the late 1990s, C compilers have been taking advantage of undefined behavior
> > in the C standard to introduce new optimizations.
>
> No it is actually the other way around. The C standard voluntarily
> leaves certain behavior undefined to have leeway for compiler and
> library implementors to do what they (think they) have to do. So there
> is a clear distinction what UB means for "user" code and for the
> implementation.
>
i agree..
> musl (and other C libraries I suppose) heavily rely on specific
> properties of compilers, that is basically all what the writing of a C
> library for a specific platform is about.
..but musl does not want to depend on special compiler
properties, so i disagree with this.
a libc should not make unnecessary assumptions about
other components of the implementation.
(there are cases where the assumptions are necessary
and reasonable, but negative shift is always possible
to avoid).
and it is a good thing to know our assumptions beyond
the guarantees of the standard (eg. musl relies on that
int is 2's complement and at least 32bit) so bug reports
about "ub" or "idb" is ok.
next prev parent reply other threads:[~2015-07-17 23:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-17 19:55 Pascal Cuoq
2015-07-17 20:23 ` Jens Gustedt
2015-07-17 23:40 ` Szabolcs Nagy [this message]
2015-07-17 23:56 ` Jens Gustedt
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=20150717234002.GA8664@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).