home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / pascal / 7985 < prev    next >
Encoding:
Internet Message Format  |  1993-01-09  |  1.9 KB

  1. Path: sparky!uunet!cs.utexas.edu!sun-barr!olivea!charnel!sifon!CC.UMontreal.CA!pigeons
  2. From: pigeons@JSP.UMontreal.CA (Pigeon Steven)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Re: untyped vars
  5. Message-ID: <1993Jan9.163613.19275@cc.umontreal.ca>
  6. Date: 9 Jan 93 16:36:13 GMT
  7. References: <34921@adm.brl.mil>
  8. Sender: news@cc.umontreal.ca (Administration de Cnews)
  9. Organization: Universite de Montreal
  10. Lines: 53
  11.  
  12. In article <34921@adm.brl.mil> ATURNER@rcnvms.rcn.mass.edu (Alan Turner) writes:
  13. >Date sent:  1/7/93
  14. >
  15. >Hello to all,
  16. >
  17. >I am curious - TP allows for untyped vars as in parameter lists:
  18. >
  19. >ex:   procedure something(a : word; b: byte; var c)
  20. >                                             ^^^^^
  21. >I would like to know of some wonderful uses for such a thing in addition
  22. >to comparing the size of two variables as in TP60.man pg 107-108.
  23. >
  24. >
  25. >
  26. >-=Alan Turner=-                
  27. >-=Email: aturner@ecn.mass.edu=-
  28.  
  29.  
  30. One "wonderful use" for untyped variables is precisely when you dont quite
  31. care for types. Exactly as "blockread" and "blockwrite", on which you can
  32. read in the manual, or to program routines that are non "type-oriented" but
  33. only "size" or "byte-packet" oriented. I wrote some time ago a unit for
  34. string management (in replacement of the system routines, copy, insert,
  35. delete, etc) giving a respectable improvement (sp?) of 6 to 10 times faster,
  36. (sorry, that's not the point) and all strings are refered as "var a;", with
  37. no type, thus avoiding the fallowing bug:
  38.  
  39.  
  40. type shortstring= string[40];  { say}
  41.  
  42. ...
  43.  
  44. var a:shortstring;
  45.     ...
  46. begin
  47.  ...
  48.  delete(a,1,10);
  49.  ...
  50. end;
  51. ...
  52.  
  53. And getting an "type mismatch" when strict var/type option is on. You can find
  54. another half-a-dozen "wonderful uses" for untyped variable.
  55.  
  56.     Regards,
  57.  
  58.         S.
  59.  
  60. -- 
  61. ------------------------------------------------------------
  62.  STEVEN PIGEON, a.k.a pigeons@jsp.umontral.ca, planet Earth.
  63. ==Departement d'informatique et de Recherche Operationnelle=
  64.               == Universite de Montreal==
  65.