Re: C ethics question



Servé Laurijssen said:


"Harald van D?k" <truedfx@xxxxxxxxx> wrote in message
news:1175340222.133195.49390@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Servé Laurijssen wrote:

Now the comparison of these pointers is UB in C [...]

No, it isn't.

oh, I thought that you can only compare pointers if they are declared
in the same object.

You're thinking of relational < <= >= > comparisons. There is no problem
with equality == != comparisons.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
.



Relevant Pages

  • Re: Financial Equality and Wealth Distribution
    ... Pointers to a more appropriate group are ... equality are really merely arguing for 'less inequality' (as others have ... inequality seems to be inevitable. ... But do smart people "deserve" to have more than dumb people? ...
    (sci.econ)
  • Re: ptr1 == ptr2 but (int)ptr1 != (int)ptr2
    ... The standard guarantees that comparing for equality always works. ... segmented world of real-mode x86 systems, "far" pointers (which ... consisted of a 16-bit segment and a 16-bit offset) only compared ...
    (comp.lang.c)
  • Re: Memory Question
    ... and i need to access through pointers.. ... Look up B+-trees in Knuth. ... Richard Heathfield ... rjh at the above domain, ...
    (comp.lang.c)
  • Re: pointer equality
    ... Of course it should be "The C Programming Language". ... : Pointers comparison is defined only for parts of the same object: ... The equality operators follow the same rules as the relational ... relational operators on pointers to distinct objects cause undefined ...
    (comp.lang.c)
  • Re: set double array to 0.0
    ... > void * pointers for anything but equality. ... > that is not guaranteed (you cannot compare pointers for other than ... > equality unless they are pointers within the same object). ... If so, yes, I assume a flat memory ...
    (comp.lang.c)