🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3808

Re: constness of private members and methods

#3808
From: Andrew Bell
Date: Tue, 26 Mar 1996 07:19
36 lines
2290 bytes
Philippe Verdy <100105.3120@compuserve.com> wrote:

>Many recursive data structures require algorithms to handle
>them which have to mark and unmark all scanned objects in
>order to avoid infinite recursion when walking on that
>structure, or when building items iterator.

The property of being marked is really part of your algorithm, not
part of the object itself.  You should consider making some sort of
separate record (a list of some sort) to indicate which items are
marked and unmarked.  Otherwise, you'll then find an algorithm where
you have to mark things twice, and so on...

>Is there any way (or proposal) to explicitly specify members
>of a class definition which are relaxed on constness certi-
>fication ?

Sounds like "mutable" to me.

>And is constness definition a semantic only definition,

Being const means only that the current function won't change the
object, not that the object itself won't change during the function.
It could change as the result of a side effect of another function
called within the current one.  Thus unless only inline or other
internally known functions are called, no additional optimizations are
possible.

Andrew Bell
abell@mindspring.com
---
[ 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         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
Technical Details
Message-ID: <4j7tfi$1npo@mule1.mindspring.com>
Path: arc1-ca.pugleaf.net!cs.mu.OZ.AU!bounce-back
References: <4j49e0$8fo@dub-news-svc-4.compuserve.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!cs.mu.OZ.AU!bounce-back
From: abell@mindspring.com (Andrew Bell)
Newsgroups: comp.std.c++
Subject: Re: constness of private members and methods
Date: 26 Mar 96 07:19:43 GMT
Organization: MindSpring Enterprises
Approved: fjh@cs.mu.oz.au
Message-ID: <4j7tfi$1npo@mule1.mindspring.com>
References: <4j49e0$8fo@dub-news-svc-4.compuserve.com>
NNTP-Posting-Host: munta.cs.mu.oz.au
X-Original-Date: Tue, 26 Mar 1996 04:59:54 GMT
X-Newsreader: Forte Agent .99.82
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMVeamuEDnX0m9pzZAQFmkAF9E61+BQ+dorfTWX9YInA+sxWhuGLapLk4
 BTS4cRzHRKHRSzuXFQKhk0kHuwEZTWB7
 =2gwE
Originator: fjh@munta.cs.mu.OZ.AU