| | | | Browse by category |
Software Parts Manager (SPM) asks customer about RW_CENTRUY_REQD macro during the Build phase of Tools.h++. Failure to use this macro can manifest itself with coredumps or assertion failures when two digit dates are entered (see below)
Cause
The SPM is prompting the user to answer whether or not it should enable the RW_CENTURY_REQD macro. This macro, when enabled will tell Tools.h++ to fail at runtime if a two digit date is entered into any RWDate or RWDBDate object. This is intentional and is to ensure four digit dates are entered (for Y2K compliance).
Action
This macro guards certain parts of the Tools (RWDate and RWLocale) and DBTools (RWDBDate) code that, when set to 1 (enabled) will run code testing for four digit years (>= 100). In the debug version, this is coded as an assertion (assert date >= 100). In release, this assertion fails at runtime with a core.
Customers receiving cores or assertion failures when a two digit date is entered should check if the RW_CENTURY_REQD macro is set. If it is, they should only provide four digit years to the program.
Please note that this is an assertion, not an exception. This means that it cannot be caught by an error handler routine. This makes the macro useful with inhouse code testing but almost impossible to implement in user code where any user can enter a two digit number for a year and get a core dump. This should, of course, be checked by the developer with an if statement before the end user can fail this assertion (i.e. before the value is given to RWDate).