Quantcast
Channel: Does C have an equivalent of std::less from C++? - Stack Overflow
Browsing latest articles
Browse All 5 View Live

Answer by chux for Does C have an equivalent of std::less from C++?

Does C offer something with similar functionality which would allow safely comparing arbitrary pointers. No First let us only consider object pointers. Function pointers bring in a whole other set of...

View Article


Answer by JL2210 for Does C have an equivalent of std::less from C++?

No. I once tried to find a way around this but I couldn't find anything. Your best bet is probably casting to uintptr_t and hoping the compiler does the right thing.

View Article

Does C have an equivalent of std::less from C++?

I was recently answering a question on the undefined behaviour of doing p < q in C when p and q are pointers into different objects/arrays. That got me thinking: C++ has the same (undefined)...

View Article

Answer by Peter Cordes for Does C have an equivalent of std::less from C++?

On implementations with a flat memory mode (basically everything), casting to uintptr_t will Just Work.But systems with non-flat memory models do exist, and thinking about them can help explain the...

View Article

Answer by supercat for Does C have an equivalent of std::less from C++?

The C Standard explicitly allows implementations to behave "in a documented manner characteristic of the environment" when an action invokes "Undefined Behavior". When the Standard was written, it...

View Article

Browsing latest articles
Browse All 5 View Live




<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>