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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3498dd887729ed19 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Garbage Collection in Ada Date: 1996/10/16 Message-ID: #1/1 X-Deja-AN: 189819148 references: <01bbb910$f1e73f60$829d6482@joy.ericsson.se> <199610132138291604607@dialup101-6-14.swipnet.se> <19961014235451303023@dialup118-1-7.swipnet.se> <19961016113936528855@dialup120-4-1.swipnet.se> organization: New York University newsgroups: comp.lang.ada Date: 1996-10-16T00:00:00+00:00 List-Id: Lars said "There is the "as if" rule. As long as the program behaves "as if" the pointer requirements are met, such an optimization is probably ok. That is, as long as no program can detect that it's there. A conservative collector might detect that and report its findings through a premature reuse of memory so it's not allowed;-) OTOH a conservative collector (written in C or C++) must play games with pointers that are in principle unportable too to detect the optimizer-bug so some might perhaps say that this doesn't count." Such optimization is definitely OK, the fact that incorrect programs, such as any conservative collector, can detect that the optimization is in place is irrelevant, and it is not just that "some may say this", it is absolutely clear. You can't have it both ways. Either you think in terms of the C that people actually write, that in practice works even if the standard does not sanction it. This is the kind of semantics required to write a conservative collector. OR You are a strict ANSI C person who will not tolerate such code. In the first case, user code can then play games no worse than your conservative collector and defeat it. In the second case, the conservative collector itself violates the rules. In practice, you can get along with the conservative collector pretty well. In practice it works even though it violates the rules In practice, user code does not happen to do things that defeat it (though please for example do not try to use the Boehm collector with the gigi code in GNAT, it will likely not work, although actually I think it is probably OK, even though this code uses virtual origins, I think the "real" pointers are still around.