Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, コンパイラーおよびランタイム 移行ガイド

GOTO の欠点

次のコード・フラグメントを見てください。

   dcl x(4) label;

   goto x(n);
   x(4):;
   put skip list( n );
   x(3):;
   put skip list( n );
   x(2):;
   put skip list( n );
   x(1):;
   put skip list( n );

n < 1 または n > 4 であり、かつ SUBSCRIPTRANGE 条件が有効になって いない場合、このプログラムは間違っています。

従来のコンパイラーでは、通常は記憶保護例外が発生しました。

新しいコンパイラーでは、ONCODE=9003 が設定された ERROR 条件が発生 して、次のメッセージが表示されます。

IBM0751S  ONCODE=9003  A GOTO was attempted to an element of a label constant
         array, but the subscripts for the element were not those of any
         label in that array.

Terms of use | Feedback

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