home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / mswindo / programm / misc / 3467 < prev    next >
Encoding:
Text File  |  1992-11-17  |  1.9 KB  |  72 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!ukma!wupost!spool.mu.edu!agate!stanford.edu!leland.Stanford.EDU!bumbles
  3. From: bumbles@leland.Stanford.EDU (Steven Alexander)
  4. Subject: Need error handling ideas
  5. Message-ID: <1992Nov16.213552.27428@leland.Stanford.EDU>
  6. Sender: news@leland.Stanford.EDU (Mr News)
  7. Organization: DSG, Stanford University, CA 94305, USA
  8. Date: Mon, 16 Nov 92 21:35:52 GMT
  9. Lines: 61
  10.  
  11.  
  12. Please reply to email address:
  13. sun!kla!anil OR kla!anil@sun.com
  14.  
  15. I am curious what kind of mechanisms other people have
  16. devised to handle errors and aid debugging of their
  17. applications in C++ and Windows. I am NOT talking about
  18. full blown exception handling.
  19.  
  20. Just simple things like failure of 'new' or file open.
  21. What I am using now is nested conditional constructs.
  22.  
  23. e.g.
  24. In a constructor for a dialog box with 3 buttons and 1
  25. static text,
  26.  
  27. {
  28.   button1 = new TButton( ... );
  29.  
  30.   if (button1) {
  31.     button2 = new TButton( ... );
  32.  
  33.     if (button2) {
  34.       button3 = new TButton( ... );
  35.  
  36.       if (button3) {
  37.         label = new TStatic( ... );
  38.  
  39.         if (label) {
  40.            // SUCCESS
  41.         } else {
  42.            // label failed
  43.               MessageBox( ... );
  44.         }
  45.       else {
  46.          // Button3 failed
  47.             MessageBox( ... );
  48.       }  
  49.     else {
  50.        // Button2 failed
  51.           MessageBox( ... );
  52.     }
  53.   else {
  54.      // Button1 failed
  55.         MessageBox( ... );
  56.   }
  57. }
  58.  
  59. As you see, this gets messy as the number of components increase.
  60.  
  61. Also, this does not provide the user, retry, cancel or ignore
  62. options.
  63.  
  64. Are there any class libraries out there to facilitate this kind
  65. of error handling? Are there mechanisms inherent in C++ or Windows?
  66. Overloading of new in the above case looks like a probable solution?
  67. Send me your replies and should there be sufficient interest I will
  68. summarize and post.
  69.  
  70. Thanks.
  71. Anil            sun!kla!anil OR kla!anil@sun.com 
  72.