home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / amiga / programm / 18584 < prev    next >
Encoding:
Internet Message Format  |  1993-01-12  |  2.9 KB

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