From -1219336029992471282
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,2340bb60e0f0f248
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2002-02-15 09:21:01 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
Newsgroups: comp.std.c++
Subject: Re: proposal for resolution of "valarray operator[] const returning value" (closed isuue 77)
Date: Fri, 15 Feb 2002 17:20:16 GMT
Organization: CMLA, ENS Cachan -- CNRS UMR 8536 (France)
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <flr8nm656o.fsf@jambon.cmla.ens-cachan.fr>
References: <a4goca$5ln$1@nets3.rz.RWTH-Aachen.DE> <flwuxg0z6l.fsf@jambon.cmla.ens-cachan.fr> <a4ijua$hij$1@nets3.rz.RWTH-Aachen.DE>
X-Trace: mail2news.demon.co.uk 1013793623 mail2news:19865 mail2news mail2news.demon.co.uk
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
Mime-Version: 1.0 (generated by tm-edit 7.106)
Content-Type: text/plain; charset=US-ASCII
NNTP-Posting-Date: Fri, 15 Feb 2002 17:11:27 +0000 (UTC)
X-Newsreader: Gnus v5.6.45/Emacs 19.34
Lines: 86
Xref: archiver1.google.com comp.std.c++:9662

Markus Werle <numerical.simulation@web.de> writes:

| Gabriel Dos Reis wrote:
| 
| > More importantly, it makes valarray<> unusable in most real world
| > programs.  There are plenty of numerical routines out there written in
| > C and passing valarray<> data to them for inspection is not as trivial
| > as it should have been or intented :-(
| > 
| > FYI, the GCC/g++ changed that operator to return a const reference.
| 
| Yes, I fell into the trap when gcc-compliant code did
| not compile with intel's C++.
| IMHO this is the wrong way to go either. 

I'm disposed to be convinced.

| I dislike the freedom
| gcc developers took without noticing me in the README. 
| ISO conformance is a must, so we must change the standard if it 
| does not fit, not our "private" library.

ISO conformance isn't a goal in itself.  The tool has no practical
value if it can't be used.  When a strict ISO conformance leads to
unuable tool, then something must be done.  That is why we DR
submissions. I've choosed not to wait -- after several papers and
discussions about the issue. Another example is accessiblity. A strict
conformant implementation makes the helper classes unuable.  

| > | I for myself can think of a lot of cases in which I wished
| > | to have all the functionality of valarray, but a return type of
| > | const reference, (e.g. valarray<map<size_t, double> > for
| > | compressed matrices)
| > | and so I propose an extension of valarray which
| > | I think does not break existing, conformant code.
| > 
| > I have trouble to conceive a real-world program which would be broken
| > if that operator's return type were changed to const reference.  So
| > let keep it simple and straight.
| 
| I disagree here.

If you have concrete real-world examples, I would be very glad to
discuss it.

| Both ways have their pros and cons
| and if You are honest they balance quite well.

I don't know I'm supposed to take that.  

| Those who struggle with connection to fortran and C
| need the reference (which speeds code by a factor of 10 or more)

The valarray<> class was primary designed to serve also those people.

| and those who have a Pentium 4 and the intel compiler 
| need the copy (sometimes), because this may speed up 
| by a factor of 10 or more due to funny register magic 
| I do not want to learn about.

I'll ask again: Do you have a real world case where returning a const
reference makes any difference in performance? 

[...]

| Let us stop a never ending fruitless
| discussion with a quite elegant whip.
| 
| Have You any argument against my approach?

Yes: It ignores reality.  The issue isn't about Stellar Abstract
Algebra.  Would you mind to give us concrete example (i.e. a
program) we can start with? 

Also, I find your posting unncessarily personnal and I'm surprised to
fint it passed the moderation filter.

-- 
Gabriel Dos Reis, dosreis@cmla.ens-cachan.fr

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]



