Sujet : Re: May a string span multiple, independent objects?
De : tr.17687 (at) *nospam* z991.linuxsc.com (Tim Rentsch)
Groupes : comp.std.cDate : 08. Aug 2024, 16:51:26
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <86v80bgght.fsf@linuxsc.com>
References : 1 2
User-Agent : Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Hans-Bernhard Bröker <
HBBroeker@gmail.com> writes:
Comparing pointers pointing at distinct objects is already invalid
(for some interpretation of "invalid"), [...].
Using relational operators (<, <=, >, >=) to compare pointers to
distinct objects has defined behavor only if the pointed-to objects
are sub-objects of the same containing object.
Equality operators (==, !=) may be used, with defined behavior,
to compare pointers to any objects, regardless of whether the
pointed-to objects belong to an enclosing containing object.
Yes, that means the implementation of a function like memmove()
cannot be fully portable C.
The function memmove() can be defined in fully portable C. It's
just more convenient to write it in a way that takes advantage of
implementation internals.