home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / pascal / 7544 < prev    next >
Encoding:
Text File  |  1992-12-17  |  3.1 KB  |  75 lines

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!rpi!ghost.dsi.unimi.it!univ-lyon1.fr!cismibm.univ-lyon1.fr!ppollet
  2. From: ppollet@cismibm.univ-lyon1.fr (Patrick POLLET)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Re: Turbo Pascal V6.0 BUG?! Fixed?
  5. Date: Thu, 17 Dec 1992 10:05:23 GMT
  6. Organization: INSA  CENTRE INFORMATIQUE DU 1er CYCLE
  7. Lines: 63
  8. Message-ID: <ppollet.78.724586723@cismibm.univ-lyon1.fr>
  9. References: <1992Dec16.182311.45706@kuhub.cc.ukans.edu> <1992Dec17.004658.26894@news.acns.nwu.edu>
  10. NNTP-Posting-Host: 134.214.232.25
  11.  
  12. In article <1992Dec17.004658.26894@news.acns.nwu.edu> delusion@casbah.acns.nwu.edu (Albert Schmezer) writes:
  13. >From: delusion@casbah.acns.nwu.edu (Albert Schmezer)
  14. >Subject: Turbo Pascal V6.0 BUG?! Fixed?
  15. >Date: Thu, 17 Dec 1992 00:46:58 GMT
  16.  
  17. >        Hello all. I seem to have uncovered some bugs in Turbo Pascal V6.0
  18. >that I hope some people could shed some light on. Are these internal bugs? Can
  19. >they be fixed? Are they fixed in TP 7.0 or BP 7.0?
  20.  
  21. >var     i: integer;
  22. >        l: longint;
  23.  
  24. >begin
  25. >        i:=400; l:=i*104;
  26. >end.
  27.  
  28. >        It will return a NEGATIVE number! Switch the i variable to a longint,
  29. >and it will work fine! Why?! 
  30.  
  31. That's not a bug but the standard behaviour of the integer type.
  32. When you declare a variable of a given type, say integer , you 
  33. declare to the compiler  that you are conscient that the 
  34. values taken by that varaible will always be in a certain range....
  35.  
  36. Integer goes from -32768 to 32767.   (that is storage within a word
  37. of 16 bits with one bit for sign and 15 for the abs(value).
  38.  
  39.   Assembly language calculations with integers do not check overflow
  40. conditions. So if a result gets too big, the bit 15 may get set to 1
  41. and the number "looks" negative ...
  42.   so you result 104*400 = 41600 is out of range. It is returned as 
  43.   41600-65536 i.e. -23936  
  44. the same is true with  additions (try 20000+20000) (-20000 -20000)....
  45.  
  46. You may experiment with it using the Evaluate... in the Debug Menu of TP6
  47. ( use the ,h specifier to get results in HEX, and you will see when 
  48. the bit 15 gets set to 1)
  49.  
  50. >        2.) ALL the Turbo products (Turbo Pascal V5.0, 6.0, Turbo C, and Turbo
  51. >C++ V2.0) refuse to work with my EMS driver (ACCEMM.SYS). They lock up
  52. >immediately upon bootup. WHY?! Hmmmm!
  53.  
  54.      They seem to dectect your EMS driver but not using it properly.
  55.  It the version up to date ? 
  56.  
  57.  In TP6 there is a command line option /X to DISABLE the usage of EMS  
  58.  even if one is present 
  59.    something like TURBO -X-  (* the minus after is to turn it off*)
  60.    check the User Guide beginning of Section IDE reference....
  61.  
  62.   The same option may be present in the others products (? ) I don't 
  63. have them... 
  64. ppollet@cismibm.univ-lyon1.fr (Patrick POLLET)
  65. --------------------------------------------------------
  66. Dr Patrick L.Pollet
  67. Institut National des Sciences Appliquées
  68. Centre Informatique du 1er Cycle  Bat 110
  69. 20 Avenue A.Einstein
  70. 69621 Villeurbanne Cedex France
  71. --------------------------------------------------------
  72. Phone: 72 43 83 80 -   la premiere erreur c'est
  73. Fax  : 72 43 85 33 -   de se lever le matin  ... GASTON
  74. -------------------------------------------------------
  75.