home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c100 / 2.ddi / BUGLST.ZIP / BUGLIST1
Encoding:
Text File  |  1990-08-27  |  8.5 KB  |  205 lines

  1.  
  2.     Product:    Borland Turbo-C++ 1.0
  3.  
  4.     Author:        Marshall P. Cline, Ph.D.
  5.             ECE department
  6.             Clarkson University
  7.             Potsdam, NY  13676
  8.  
  9.     Voice:        315-268-3868
  10.     Secretary:    315-268-6511
  11.     FAX:        315-268-7600
  12.  
  13.     ARPA:        cline@sun.soe.clarkson.edu -or- bh0w@clutx.clarkson.edu
  14.     Bitnet:        BH0W@CLUTX
  15.     UUnet:        uunet!clutx.clarkson.edu!bh0w
  16.  
  17.     Copyright:    The Author releases this to the Public Domain
  18.  
  19.     Date:        June 11, 1990
  20.     Revised:    August 9, 1990
  21.     Revised:    August 14, 1990
  22.  
  23.  
  24. Copyright:
  25.     This file, along with code fragments it contains, is public domain.
  26.     That means no one (including myself) can restrict its use/distribution.
  27.     In particular, you can't copyright it.  No one can.  Not even me.
  28.  
  29. Contributions:
  30.     If you have a TC++ bug to report, please email to the above addresses.
  31.     But please try to find/send a work-around to the problem/bug.
  32.     Also please explicitly state that your comments/code are public domain.
  33.  
  34. -----------------------------------------------------------------------------
  35.  
  36. Several classlib\include\*.h have #include "foo.h" rather than <foo.h>.
  37. This will only cause a problem if you have an indentically named header file
  38. in your current working directory (#include "file.h" starts in current dir,
  39. then searches the "standard places"; <file.h> only searches standard places).
  40. Note that TC++ by default doesn't find the classlib header files; if you want
  41. it to, add the line to turboc.cfg:  -IC:\TC\CLASSLIB\INCLUDE
  42.  
  43.  
  44. Some include files have #ifndef __FILENAME_H, others have #ifndef _FILENAME_H.
  45. (inconsistent #leading underscores).  See for example sortable.h vs set.h, etc.
  46.  
  47.  
  48. TCCNVT.EXE (the configuration file converter) isn't in the distribution.
  49.  
  50.  
  51. `make -n' looks for and reads `builtins.mak' ONLY if it's in the current dir.
  52. Naturally this is a bug, since make can't give an accurate picture of what a
  53. real `make' would do without the macros and implicit rules in `builtins.mak'.
  54.  
  55.  
  56. <iostream.h> always includes <mem.h> which slows compilation some.  In fact
  57. <iostream.h> doesn't need `NULL', and only needs memcpy() if _BIG_INLINE_ is
  58. defined, which will probably be rare.  Therefore the line
  59.         #include <mem.h>        // to get memcpy and NULL
  60. can be replaced with:
  61.         #ifdef _BIG_INLINE_
  62.         #include <mem.h>        // to get memcpy
  63.         #endif
  64. Since nearly everything includes <iostream.h>, and since relatively few things
  65. will want _BIG_INLINE_, this should be a winner.  Note however that some code
  66. might assume <iostream.h> pulls in <mem.h>.
  67.  
  68.  
  69. <iomanip.h> needs <iostream.h> but doesn't get it.  Add this to <iomanip.h>:
  70.         #ifndef __IOSTREAM_H
  71.         #include <iostream.h>
  72.         #endif
  73.  
  74.  
  75. There is no <new.h>.  I constructed the following work-alike.  It should go
  76. into your standard include directory (where <iostream.h> is, for example):
  77.     // new.h
  78.     // Author: Dr. Marshall Cline/ECE Dept/Clarkson Univ/Potsdam,NY 13676
  79.     // Email: cline@sun.soe.clarkson.edu
  80.     // Phone: Voice: 315-268-6511; Fax: 315-268-7600
  81.     // Copyright: The Author releases this to the Public Domain, 9-July-90.
  82.     // Date: 9-July-1990
  83.     // Please include these acknowledgements when distributing this file
  84.     #ifndef __NEW_H
  85.     #define __NEW_H
  86.     #ifndef _SIZE_T
  87.     #define _SIZE_T
  88.     typedef unsigned size_t;
  89.     #endif
  90.     void*  operator new(size_t size, void* ptr);
  91.     // _new_handler is a ptr to a parameterless function returning void
  92.     extern void (*_new_handler)();
  93.     void (*set_new_handler(void (*replacement_handler)()))();
  94.     #endif __NEW_H
  95.  
  96.  
  97. Bug in istream: an extremely common C++ main input loop is something like:
  98.         while (cin >> chunk) chunk.do_something();
  99. This works under the condition that istream::operator void* returns 0 (false)
  100. after the input stream reads past EOF (or encounters an error).  TC++'s
  101. iostream.h is consistent with its documentation [programmer's guide p.183] in
  102. stating that this operator returns 0 only when istream::fail() is true (when
  103. failbit, badbit or hardfail are set), but unfortunately `fail' doesn't get
  104. set after you've read past EOF.  The correct operation is to return 0 (false)
  105. on the read after you've run into EOF as well [Lippman p.384], which CAN BE
  106. accomplished by the _bad bit being set wnen seeking past end-of-file [Lippman
  107. p.402].  This can be fixed by changing "ios::operator void*()" in <iostream.h>
  108. as follows:
  109.     inline _Cdecl ios::operator void* ()
  110.     { return (state & (eofbit|failbit|badbit|hardfail)) ? 0 : this; }
  111. NB: the `official' (if there is such a thing in these pre-ANSI-C++ days)
  112. behavior of istream::operator>> isn't clear.  I've discussed this matter with
  113. both Borland, and with a collegue who is in charge of certain C++ libraries
  114. inside AT&T, and no one is yet sure what is really ``supposed'' to happen.
  115. The above patch (checking the eofbit) appears to work correctly, but it may
  116. be that a more comprehensive solution is eventually in order.  In any event,
  117. most people's code doesn't run around checking individual bits inside an ios,
  118. so the above is probably `safe'.
  119.  
  120.  
  121. There is an error in TCC that isn't in TC (they generate different code).
  122. [Borland is as surprised that they'd behave differently as I was; I'd imagine
  123. the internals are identical, and this assumption has be confirmed by Borland].
  124. When a virtual fn is called from a non-virtual inline member, the virtualness
  125. of the call vanishes.  Compile the following with `tcc -vi':
  126.         #include <iostream.h>
  127.         class B {
  128.         public:
  129.           virtual void virt();
  130.           void nonvirt() { cout << "B::nonvirt() calling "; virt(); }
  131.         };
  132.         class D : public B {
  133.         public:
  134.           void virt();
  135.         };
  136.         main()
  137.         {
  138.           D d;
  139.           (&d)->nonvirt();  // B::nonvirt() should call D::virt()
  140.           d.nonvirt();      // ditto
  141.         }
  142.         void B::virt() { cout << "B::virt()\n"; }
  143.         void D::virt() { cout << "D::virt()\n"; }
  144. Unfortunately both of these call B::nonvirt().
  145. Ie:Both d.nonvirt() & (&d)->nonvirt() translate to "call near ptr @B@virt$qv".
  146. Obviously these should be virtual function calls.  This is a serious error, as
  147. calling a virtual from a non-virtual is fairly common.  Note: if B::virt() is
  148. a pure virtual (another legal operation, but perhaps not as common), the call
  149. to "@B@virt$qv" generates a linker error (there is no B::virt()!).  If
  150. B::nonvirt() is a regular (non-inline) function (either by moving it out of
  151. the class, or by `-v' or `-vi-'), TCC generates the correct code.  Strangely
  152. enough, TC appears to *always* generate the correct code.
  153.  
  154.  
  155. The 1.2 streams package (called <stream.h>) is nice, however AT&T treats the
  156. inclusion of <stream.h> as an alias to <iostream.h>.  Therefore you should
  157. rename it from <stream.h> to <oldstream.h>, and let <stream.h> simply be:
  158.         #include <iostream.h>
  159. It is notable that a number of posters on comp.lang.c++ have been confused by
  160. including <stream.h> thinking they were getting <iostream.h>...
  161.  
  162.  
  163. <generic.h>: Instead of using the usual "name2" style macros, Borland
  164. invented their own set of macros for concatenating pieces of names.  Any code
  165. using the Stroustrup-style macros (eg. code compatable with g++, CC, or
  166. Zortech C++) will break.  A work-around is to stick the following on the
  167. bottom of your <generic.h>:
  168.             #define name2 _Paste2
  169.             #define name3 _Paste3
  170.             #define name4 _Paste4
  171. This bug and its work-around is thanks to:
  172.     Pete Humphrey / pete@edsr.eds.com / 505-345-1863
  173.     EDS Research / 5951 Jefferson Street NE / Albuquerque, NM  87109-3432
  174.  
  175.  
  176. TC++ signals a compiler error when the LAST default parameter for a
  177. constructor is initialized by a constructor for some other class.  A
  178. workaround is to add an extra dummy default parameter of some
  179. predefined type like int.  Ex: if A and B are classes, then:
  180. This will be an error:        A::A(B b = B(...));
  181. But this is ok:            A::A(B b = B(...), int dummy=0);
  182. Thanks to:Zerksis Umrigar/umrigar@bingvaxu.cc.binghamton.edu/SUNY Binghamton NY
  183.  
  184.  
  185. When an object is created as a side effect of an expression, and the expression
  186. is short-circuited, the destructor for the object seems to get called anyway:
  187.     class X {
  188.     public:
  189.       X   create_copy_of_X() { return *this; }    //Return *BY VALUE*
  190.       int whatever();
  191.       //...
  192.     };
  193.     main()
  194.     {
  195.       X x;
  196.       //...
  197.       if (0 && x.create_copy_of_X().whatever()) stmt;
  198.       //...
  199.     }
  200. At the close of main(), TC++ calls a destructor on the copy of `x' even though
  201. the copy was never properly constructed.  This only happens when inline functns
  202. are NOT inlined.  Thanks to: Jamshid Afshar/jamshid@ccwf.cc.utexas.edu
  203.  
  204.  
  205.