Fully transitive const is not necessary

Janice Caron caron800 at googlemail.com
Wed Apr 2 01:24:26 PDT 2008


On 02/04/2008, Bill Baxter <dnewsgroup at billbaxter.com> wrote:
>  But this dodgy code will
>
>  void f(const C c) {
>     some_global++;
>  }
>
>  So const isn't a guarantee of thread safety.

Correct. And nobody's saying it is. You, me, Walter, Andrei - we all
agree on this point, so it needs no further discussion.

This is simple logic. A => B isn't the same thing as B => A. Unless of
course you would argue that everything with four legs is a dog.

(1) const does not guarantee thread safety
(2) thread safety requires const guarantees

Both of these statements are simultaneous true.



>  So it seems "const is necessary for multiprogramming" is not quite the
> whole truth, which was all the original poster was talking about. 'Course
> that may be a strawman.  I don't know that Walter has ever said precisely
> that.

And that's the nub of the matter. Folk that have thought the whole
pure/multiprocessor thing through are saying "A => B", and detractors
are saying "Wait a minute, B !=> A". It's sort-of a strawman, but only
in the sense of misunderstanding.



More information about the Digitalmars-d mailing list