The __D macro is used to simplify code that requires the frequent use of the _ConvertDecimal constructor. Because the __D macro is equivalent to the _ConvertDecimal constructor, the __D macro cannot used be with a case statement. A valid case statement uses an integral constant expression. This code shown in the following figure results in a compiler error:
Figure 208. Example of Code with Decimal Constants and a Case Statement that Are Incompatible
decimal(4,3) op;
switch int(op) {
case int(__D("1.3")):
.....
break;
}
|
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.