|
> From: Rich Duzenbury > > I'm curious, do you plan to leave the asserts in the production version of > the code, or are you limiting them to the debug version? In a general 'C' > environment, I would expect the asserts to be compiled only into the debug > version, but I haven't made any decisions about what I might do in RPG > yet. Interesting point. It seems to me there are two classes of fatal ("assertable") errors: logic errors and data errors. In an XML file, for example, it's quite easy to not close a tag, which would lead to a stack underflow. This is a fatal error that needs to be in even the runtime. On the other hand, a divide by zero when I have control over the divisor, I would think that's a logic error that COULD be removed. Maybe. In either case, you have to be careful with the Assert, as opposed to an if/endif. Because the assert passed the error message to the assertion test method, it is formatted every time. If your message is not a constant, that could lead to a ton of overhead. So, for me, I'll probably have an Assert method for hardcoded errors and use if/endif for messages that require more information. Thinking about it, it seems that the data-centric fatal errors will probably always need extra information, so my guess is that any errors that will stay in the production code will probably NOT use the assert. Too bad. I wish there were a way around that (and probably there is, using callbacks or whatnot, but by that time the logic gets awfully convoluted). Joe
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.