Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Feb 2018 15:27:21 -0500
From:      Garrett Wollman <wollman@csail.mit.edu>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        freebsd-standards@freebsd.org
Subject:   Re: Marking select(2) as restrict
Message-ID:  <23181.54825.511195.393054@khavrinen.csail.mit.edu>
In-Reply-To: <20180221201002.GC94212@kib.kiev.ua>
References:  <CAF6rxg=h_oMiUu7P=GAOQf_OySQM2w31hg6Kas%2B3jeEM3qq_Cg@mail.gmail.com> <CAF6rxgnt9c0n8i-nHQwoKGbZKF2hM5AZqEJnz0CLo26XOO4_sg@mail.gmail.com> <20180221032247.GA81670@ns.kevlo.org> <CAF6rxg=WwqeBnmJzfOZgtwrYesXPfvJFeaVmQwtTa_89_sxaJg@mail.gmail.com> <CANCZdfo46bhfaRpbqOmJjk4%2B=1R2c5kvmrJPENaxNgK==5M4kg@mail.gmail.com> <CAF6rxg=wNVgDUF9o744ngmzPNeHB3hqdrLufy=yS3D4osczxFQ@mail.gmail.com> <20180221104400.GU94212@kib.kiev.ua> <23181.46427.671514.319710@khavrinen.csail.mit.edu> <20180221185920.GA94212@kib.kiev.ua> <23181.50488.186767.579361@khavrinen.csail.mit.edu> <20180221201002.GC94212@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
<<On Wed, 21 Feb 2018 22:10:02 +0200, Konstantin Belousov <kostikbel@gmail.com> said:

> Undefined != broken, whatever some compiler vendors try to bluff.

No, undefined behavior means the application is wrong.  Literally
anything may happen; the compiler does not enter into it.  The
compiler is not involved when you free() a pointer into the stack, or
pass a null pointer into a library routine that unconditionally
dereferences it, or update a string literal; nor is it involved when
you pass pointers that alias to a library routine that expects them to
point to different objects.

In the particular case of select(), there are no guarantees as to the
order in which the fd_set objects pointed to by readfds, writefds, and
exceptfds will be updated, so applications which alias them are
clearly wrong and have been since this interface was introduced in
4.2BSD.

-GAWollman




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?23181.54825.511195.393054>