Date: Sat, 18 Jul 2015 01:40:02 +0200 From: Szabolcs Nagy <nsz@...t70.net> To: musl@...ts.openwall.com Subject: Re: Re: Left-shift of negative number * Jens Gustedt <jens.gustedt@...ia.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.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.