From 947367156421743957
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e94695845965b249
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-12-03 23:35:47 PST
Newsgroups: comp.std.c++
Path: sparky!uunet!mcsun!sunic!lth.se!dag
From: dag@control.lth.se (Dag Bruck)
Subject: Re: Zero-length structures and pointer comparisons
Message-ID: <1992Dec4.070720.13056@lth.se>
Sender: news@lth.se
Organization: Department of Automatic Control, Lund, Sweden
References: <1992Nov30.195202.14370@ucc.su.OZ.AU> <1992Dec1.072440.824@jyu.fi> <1992Dec1.175548.16232@meaddata.com> <1992Dec2.111003.23102@jyu.fi> <1992Dec2.205330.10372@meaddata.com>
Date: Fri, 4 Dec 1992 07:07:20 GMT
Lines: 38

In <comp.std.c++> ralpht@meaddata.com (Ralph W. Trickey) writes:
>|> >
>|> >  I don't think that requiring total ordering would break any existing
>|> >program, but it would break quite a few existing compilers.
>
>This language change that would slow down existing programs. Possibly
>to the point where they no longer meet specifications. I consider this
>breaking programs.

Could someone do the net a great favour and check it?  There's a lot
of speculation but nobody has measured how severe the slow-down would be.

>BTW, how did this thread start? The beginning has scrolled out of my
>newsreader. I don't understand what total ordering would achieve.

A total ordering would make it easier to build some common data
structures.  For example, a binary search tree needs some sort of
comparison function.  If you are only interested in finding a
particular object in the tree (i.e., the actual ordering is
irrelevant), comparing the addresses would work nicely.

What you need in the search tree example is a total ordering for the
duration of the program execution; it does not matter if the ordering
is different the next time the program is executed.

Note that some types of objects do not have a comparison function, and
any existing comparison function may be expensive.

I think the absense of a total ordering is a much greater problem in
C++ than in C, because general purpose data structures are becoming
much more common in the shape of templates.

				-- Dag
-- 
Department of Automatic Control		E-mail: dag@control.lth.se
Lund Institute of Technology
P. O. Box 118				Phone:	+46 46-104287
S-221 00 Lund, SWEDEN			Fax:    +46 46-138118


