Topic: Error Detection/Checking/Handling in the Standard Library


Author: Sai Shankar <Sai.Shankar@blr.spcnl.co.in>
Date: Sat, 30 Dec 2000 14:06:00 GMT
Raw View
 Hi,

 I was browsing through my copy of Stroustrup yesterday and
 I happened to reread the section on Design constraints in
 "Library Organization and Containers".

 One of them was:
 [4] Either policy-free or give the user the option to supply
     policy as arguments.

 It looks to me as though error detection/checking/reporting
 is an area where the library does not provide this facility.

 For example:

 The current state of things is that [] provides unchecked
 access to the indexed element in a vector.

 If there was a traits class called vector_error_traits for
 vector, which would provide an interface for error checking,
 the decision to do error checking could be made at compile time,
 with the default being no error checking. This would involve
 no loss of efficiency for the users desiring no checking and
 would also.

 As an extension, I can also imagine error_traits providing a
 method for reporting/logging an error. This approach would provide
 much more flexibility while not affecting efficiency. I would
 also think that this _could possibly_ be retrofitted into the
 Standard, while retaining backward compatibility.

 I realize that the "Debug" mode of STLPort does provide something
 akin to this policy. But, given Scott Meyers' and James Kanze's
 experiences with it, i am chary of getting it to work. Even if i did
 manage it, it would be difficult to get others to accept it.

 Has anyone thought of this before? I would like to think not ;-)
 If so, why wasn't it followed up? Are there any objections to
 something of this kind that i have not been able to think of?
 Would it impose very cumbersome restrictions on implementors?

 Currently these are just thoughts for which i haven't worked
 out the details. So all comments/flames are welcome.

 Thanks and Rgds,
 Sai

[ Note to mods: I happen to think that this is more appropriate to csc
  than clcm. Feel free to reject it if you feel it should
  be in clcm.]

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]