From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f51e93dacd9c7fca X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-30 06:50:33 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!news-hog.berkeley.edu!ucberkeley!newshub.sdsu.edu!west.cox.net!cox.net!p02!news2.central.cox.net.POSTED!53ab2750!not-for-mail Message-ID: <3D1F0C50.9000700@telepath.com> From: Ted Dennison User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: status of Ada STL? References: <3d0ce154_5@news.bluewin.ch> <3d0e574d_2@news.bluewin.ch> <3d0fb5e8$1_3@news.bluewin.ch> <_cvS8.63267$UT.4317265@bgtnsc05-news.ops.worldnet.att.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 30 Jun 2002 13:50:32 GMT NNTP-Posting-Host: 68.12.51.201 X-Complaints-To: abuse@cox.net X-Trace: news2.central.cox.net 1025445032 68.12.51.201 (Sun, 30 Jun 2002 09:50:32 EDT) NNTP-Posting-Date: Sun, 30 Jun 2002 09:50:32 EDT Organization: Cox Communications Xref: archiver1.google.com comp.lang.ada:26793 Date: 2002-06-30T13:50:32+00:00 List-Id: Russ wrote: > Perhaps I am missing something here, but when you say the expression > "Z = 0" has a "side-effect" on Z you lose me. I don't see how > assignment can be considered a "side effect". The main job of a function is supposed to be to calculate and return a value based on its parameters/operands. If it has any other lasting effect, we call that a "side effect". If we were to look at C's "=" as a function (which C kind of does), then the "effect" of the function is to return is the value of the right operand, and the "side-effect" is that this value also gets placed into the storage location of the left operand. The reason this is confusing of course is that the whole point of assignment in C is almost always the side-effect, and the effect is rarely used. The blame for this confusion should lie with the C designers for putting confusing features in the language solely for their hack value. > If a C++ class does not explicitly define an assignment operator, the > compiler will define one by default. The default assignment operator > is often perfectly good. In fact, the only time the class should > define its own assignment operator is when the it contains a pointer > to data on the heap that needs to be copied in the assignment > operation. Otherwise, you are much better off with the default. The Not quite true. You *have* to define your own assignment function if your class contains any const members (which most of mine seem to).