C++ Logo


Advanced search

Relational operators with using pointers.

From: Vladimir Grigoriev <vlad.moscow_at_[hidden]>
Date: Wed, 30 Nov 2022 22:30:42 +0300
In the C Standard there is explicitly written that when two pointers do not point to elements of the same array (including the element or one pass the last element) the behavior is undefined:
«In all other cases, the behavior is undefined.»
However in the C++ 20 Standard I do not see such a phrase. So is the behavior is undefined or unspecified when there are compared two pointers to different objects that are not elements of the same array. as for example
&x < &y
With best regards,
(Vlad from Moscow)
You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or http://ru.stackoverflow.com

Received on 2022-11-30 19:30:50