home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / cplus / 11226 < prev    next >
Encoding:
Text File  |  1992-07-21  |  1.7 KB  |  44 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
  3. From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
  4. Subject: Re: Dimensional Type Checking
  5. Message-ID: <1992Jul21.144819.21736@ucc.su.OZ.AU>
  6. Keywords: dimensional analysis
  7. Sender: news@ucc.su.OZ.AU
  8. Nntp-Posting-Host: extro.ucc.su.oz.au
  9. Organization: MAXTAL P/L C/- University Computing Centre, Sydney
  10. References: <dreamer.0qe8@lhaven.UUmh.Ab.Ca> <1992Jul20.101402.16526@hemlock.cray.com>
  11. Date: Tue, 21 Jul 1992 14:48:19 GMT
  12. Lines: 30
  13.  
  14. In article <1992Jul20.101402.16526@hemlock.cray.com> dsf@cray.com (Dan Frankowski) writes:
  15. >
  16. >See IEEE Software, May 1988, pages 21-26, "Dimensional Analysis with
  17. >C++."  They implement a "units" class that checks the dimensions and
  18. >even converts automatically if there is a simple multiplicative factor
  19. >(for example feet to inches, but not celsius to fahrenheit).
  20. >
  21. >The disadvantage is that it's all at runtime!  This means you don't get
  22. >the line number where the error occurred, you need about 20 bytes of
  23. >extra storage per variable-with-units (even in arrays, it's 20 bytes
  24. >per element), it slows down execution, and so on.
  25. >
  26. >Is there a better way, folks?
  27. >
  28.  
  29.     You can fix the array problem with lots of nasties.
  30.  
  31.     However, it SHOULD be possible to do dimmensional analysis
  32. at compile time and it isnt. So to the experts: WHY NOT?
  33.  
  34.     What extension (to templates?) is required to allow this.
  35.  
  36.     [Um.. we need a reflexive system?]
  37.  
  38.  
  39. -- 
  40. ;----------------------------------------------------------------------
  41.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  42.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  43. ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
  44.