Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, 言語解説書

短絡計算

次の場合に、IF 式のテストは短絡化されることがあります。

ただし、コードが短絡化されるのは、以下に示す一部の式においてのみです。

必然的に、上記および NOT 接頭演算子および AND または OR の 2 項演算子で構成される式 (再帰的な 可能性のある) も短絡化されます。

したがって、例えば、次の宣言の場合、

    dcl A   bit(1);
    dcl B   bit(1);
    dcl C   bit(2);
    dcl D   bit(2);
    dcl P   pointer;
    dcl BX  based fixed bin(31);

次の IF 文がすべて短絡化されます。

    if A | B then
    if P = sysnull() | P->BX = 0 then
    if C = ''b & D = ''b then
    if A | (substr(C,1,1) & substr(D,2,1)) then

しかし、次の IF 文は短絡化されません。

    if C | D then
    if C & D then

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)