🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4304

Re: Pointer comparisons 2

#4304
From: Philip Homburg
Date: Mon, 30 Oct 1995 13:17
26 lines
1578 bytes
In article <DANIELV.95Oct29220521@crt0.crt>,
Daniel Villeneuve <danielv@crt.umontreal.ca> wrote:
%Maybe the expression `a conforming comparison function' is not clear.  In
%the context of my previous article (keeping ordered sets of structures), I
%wanted a comparison function that could be called by a sorting device (such
%as an AVL tree interface) to order items unambiguously, given that no two
%items were the same.  No more hypotheses are made on those items.
%
%After having read the previous replies about that article, I agree that the
%comparison operators < and >, if fed with invalid arguments, could lead
%to `undefined result' that could be like random (if the result exists).
%
%So my comparison functions, to be conforming, should rely on some unique
%identifier in the structures (such as an integer telling the position of
%the structure in the global list), instead of the pointer on each
%structure, even though this pointer _is_ a unique identifier for the
%structure.

And what about memcmp? I guess that you have to use memmove instead of =
to do pointer assignments...





						Philip Homburg
Technical Details
Message-ID: <DH9JLG.73C.0.-s@cs.vu.nl>
Path: arc1-ca.pugleaf.net!cs.vu.nl!philip
References: <46cu3i$6fg@solutions.solon.com> <46jiqv$pl9@solutions.solon.com> <DANIELV.95Oct29220521@crt0.crt>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!cs.vu.nl!philip
From: philip@cs.vu.nl (Philip Homburg)
Subject: Re: Pointer comparisons 2
Nntp-Posting-Host: centaur.cs.vu.nl
References: <46cu3i$6fg@solutions.solon.com> <46jiqv$pl9@solutions.solon.com> <DANIELV.95Oct29220521@crt0.crt>
Sender: news@cs.vu.nl
Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
Date: Mon, 30 Oct 1995 13:17:40 GMT
Message-ID: <DH9JLG.73C.0.-s@cs.vu.nl>