home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / std / cplus / 1776 < prev    next >
Encoding:
Text File  |  1992-12-14  |  1.6 KB  |  48 lines

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!olivea!charnel!sifon!thunder.mcrcim.mcgill.edu!sobeco!philmtl!vedge!hendrik
  2. From: hendrik@vedge.com (Hendrik Boom)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Now is the time (Was: Improvements on C++?)
  5. Message-ID: <1992Dec14.152854.25395@vedge.com>
  6. Date: 14 Dec 92 15:28:54 GMT
  7. References: <5349@holden.lulea.trab.se>
  8. Organization: Visual Edge Software Ltd.
  9. Lines: 37
  10.  
  11. jbn@lulea.trab.se (Johan Bengtsson) writes:
  12. : Johan Bengtsson (jbn@lulea.trab.se) wrote:
  13. : Fergus James HENDERSON (fjh@munta.cs.mu.OZ.AU) wrote in comp.lang.c++:
  14. : : 
  15. : : The compiler should warn about any code that has a high likelyhood of being
  16. : : a programming error, except where such code is actually necessary in some
  17. : : cases and cannot easily be rewritten to avoid the warning.
  18. : I absolutely agree.  How about this one:
  19. : // myFile.cc
  20. : class MyClass {
  21. : //...
  22. : };
  23. : IMPLEMENT_TYPE(MyClass);
  24. : "IMPLEMENT_TYPE" is a macro defined in a header file, and guess what?
  25. : I forgot to #include it.  Does the compiler warn about this?  No!
  26. : It thinks it is a function prototype with return type "int"!
  27. : How wonderful...
  28.  
  29. But C++ allows another place where you can leave out the int.
  30. How about:
  31.  
  32. typedef int Foo;
  33.  
  34. class MyClass {
  35.     MyClass(Foo())
  36. };
  37.  
  38. Is this a constructor taking a Foo-valued function argument,
  39. or a redeclaration of Foo in an inner scope as a method returning a MyClass?
  40. -- 
  41. -------------------------------------------------------
  42. Try one or more of the following addresses to reply.
  43. at work:    hendrik@vedge.com,  iros1!vedge!hendrik
  44. at home:    uunet!ozrout!topoi!hendrik
  45.