Invalid Decimal Format
In ILE C, packed decimal is implemented as a
native data type. This allows an error such as invalid decimal format
to be detected at compile time.
In C++, detection of a similar error
is deferred until runtime, as shown in the following examples:
#define _DEBUG 1
#include <bcd.h>
int main ( void )
{
_DecimalT<10,20> b= __D("ABC"); // Runtime exception is raised
} and
#define _DEBUG 1
#include <bcd.h>
int main ( void )
{
_DecimalT<33,2> a; // Max. dig. allow is 31. Again,
// runtime exception is raised
}
Note: Some errors can be detected at compile time,
for example:
n<1, (_Decimal<-33,2>).