hsutter/gcpp

Potential false positive in gpage::contains (portability)

HansOlsson opened this issue · 1 comments

The question https://stackoverflow.com/questions/69310688/strict-total-order-of-stdlesspointer uses code from this project as example of non-portable code; and to me it seems best to provide feed-back to any project when using it as an example.

Specifically the issue is that two std::less in gpage::contains https://github.com/hsutter/gcpp/blob/master/gpage.h#L241 can give false positives (i.e. that an unrelated pointer can return true - specifically for segmented memory architectures).

Feel free to:

  • Ignore
  • Just document limitation
  • Propose improvement of the standard
  • ...

Thanks! This library is a proof-of-concept that uses what I think is the most portable code for this that's possible today which should work for all flat memory architectures and probably some/many segmented ones, and this project doesn't intend to support segmented memory architectures anyway. So I'll close this as 'ignore with thanks!', but I've also looped in Davis Herring, the core language expert who gave the answer to the SO question, and Hubert Tong, a core language expert who knows a lot about non-flat architectures, since lately we seem to keep revisiting this question in the committee and one of these days the time may come to make a change in the standard.