[patch] Add a section about implementation-defined behavior to the user's manual

Nico Weber thakis at chromium.org
Tue Jan 29 16:47:46 PST 2013


On Tue, Jan 29, 2013 at 1:00 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> On Tue, Jan 29, 2013 at 10:16 PM, Nico Weber <thakis at chromium.org> wrote:
>> a coworker asked me if clang documents how it handles right shifts of
>> signed numbers today. As far as I can tell there's no documentation
>> for this, but I found PR11272 about documenting implementation-defined
>> behavior. The bug suggests just linking to gcc's documentation as a
>> first step, which is what the attached patch does. This isn't quite
>> correct (for example, clang supports UCNs without any flags), but is
>> correct for most things. People can fill in more details over time.
>
> +clang generally matches `gcc's implementation-defined
> +behavior <http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/C-Implementation.html#C-Implementation>`.
>
> Maybe there's a different wording that does not promise too much?  I
> can easily see users relying on this (or complaining about Clang's
> implementation-defined behavior being different from gcc's).

"generally tries to match"? The "generally" sounded fairly
weasel-wordy to me already.

> What might help is a list of implementation-defined behaviors with
> quotations from the standard, as a boilerplate for developers to fill
> in.  (It is much easier to write documentation when you know what
> exactly you should describe.)

I don't have a copy of the standard. I agree that's better, but until
then stating our intentions seemed preferable over saying nothing at
all.

Nico

>
> Dmitri
>
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-commits mailing list