home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!howland.reston.ans.net!usc!sdd.hp.com!nigel.msen.com!ilium!sycom!ro-chp!chopps
- From: chopps@ro-chp.UUCP (Chris Hopps)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Version Strings...
- Message-ID: <7PFhs*N00@ro-chp.UUCP>
- Date: Tue, 12 Jan 1993 09:55:03 GMT
- References: <1993Jan8.111612.25180@sunbim.be> <Per_Salmi.0lxs@augs.se> <81pgs*M00@ro-chp.UUCP>
- <C0MEv9.Awr@well.sf.ca.us>
- Summary: Reason found
- Organization: Not an Organization
- X-Newsreader: Arn V1.00 beta rel2
- Lines: 56
-
- In article <C0MEv9.Awr@well.sf.ca.us>, Greg Comeau writes:
-
- > In article <81pgs*M00@ro-chp.UUCP> chopps@ro-chp.UUCP (Chris Hopps) writes:
- > >In article <Per_Salmi.0lxs@augs.se>, Per Salmi writes:
- > >
- > >> accs1@bagheera.mumath wrote:
- > >
- > >> : >UBYTE Version[] = "\0$VER: ProgName 1.0 (7.1.92)";
- > >
- > >> : I wonder why that stays in the executable. I would expect a good compiler would
- > >> : through that line away unless it is really referenced.
- > >
- > >> You really got a point there! Why does it?
- > >
- > >this would 1) probably never work right and 2) someone would find a reason the linker
- -----------------------------------------
- > >should not be deleting non referenced data objects.
- ---------------------------------------------------
-
- > I've addressed the former in some posts yesterday so will direct you
- > to them for that. Re the latter, it can be made somewhat more likely
- > to remain in simply by changing it to:
- >
- > UBYTE *VerPtr = "\0$VER: ProgName 1.0 (7.1.92)";
- >
- > the reason being that it's simple enough to see what's not referenced,
- [rest del]
-
- Ironically enough I have found my own reason that the compiler/linker should
- not assume something is not referenced. In a shared memory system, as the amiga
- is, there can be no guarantee that another running process will not be referencing
- the data. Also I think someone else (different thread) pointed out that the
- command "Version" does indeed reference the data. Your method is "more" correct
- becuase it clearly seperates the data from the symbol. The data being stored and
- the pointer being initialized in reference to the data.
-
- Two things:
- 1) If a compiler ever went this far, I think many programmers would be pulling
- hair out left and right trying to second guess the optimizer.
- 2) Becuase someone may ignore (1) this method should work:
-
- volatile UBYTE Version[] = "\0$VER: ...";
-
- By the definition of the type qualifier volatile, the compiler would considered
- broken if it optimized this out. This also further illistrates my point that
- linker optimizations is "impossible" to do correcty. The linker does not have
- the knowledge about the symbol/data that the compiler does. I think someone
- would have to bend quite a bit of compiler theory to ever come up with a way
- around this.
-
- > - Greg
-
- Chris...
- ------------------------
- The Royal Oak Chophouse >> Chris Hopps
- Royal Oak, Michigan >> sycom.mi.org!ro-chp!chopps
-