Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
84 CHAPTER 4. CODE GENERATION<br />
One of these messages is always returned indicating the status of the operator. Normally, the<br />
result is À ÅË ÌÊÍ. Some operators return À ÅË ÁÄ like Ö Ñ or Ö ÖÓÒ to<br />
indicate that they could not open a file or there was no permission to read it. In this case the<br />
programmer has to check the return value and apply some adequate action. If the message<br />
À ÅË ÄË is ignored, errors like<br />
ÀÐÓÒ ÖÖÓÖ ¼ ÁÑ Ø ÑÒÑÒØ ÓعÁ × ÆÍÄÄ<br />
will happen in successive operators, because the predecessor operator did not calculate an appropriate<br />
value.<br />
Errors In the case of hard errors (i.e., no message as described above) the program stops<br />
with an error message. To prevent this behavior the <strong>HDevelop</strong> operators Ú ÖÖÓÖ ÚÖ<br />
and Ú ×Ø can be used to control the exception handling in the application. This<br />
works similarly in <strong>HDevelop</strong> and C++. One difference is caused by the dynamic evaluation<br />
of Ú ÖÖÓÖ ÚÖ in <strong>HDevelop</strong>. This means that each time the operator is executed (e.g., in<br />
a loop) the use of the error variable might change. In contrast to this, in C++ special code<br />
is added to store the return values of operators. This code will therefore be static and cannot<br />
change during program excecution. To understand how the code generation works let us have a<br />
look at a short example. Here at first the <strong>HDevelop</strong> program:<br />
Ú×Ø´³ÚÖÖÓÖ³µ<br />
ÚÖÖÓÖÚÖ´ÖÖÓÖ¸ØÖÙµ<br />
ØÖ×ÓдѸÖÓÒ¸½¼¼¸¾µ<br />
ÚÖÖÓÖÚÖ´ÖÖÓÖ¸Ð×µ<br />
´ÖÖÓÖ ÀÅËÌÊ͵<br />
ÛÖØ×ØÖÒ´ÏÒÓÛÁ¸³ÖÖÓÖ ÒÙÑÖ ³ · ÖÖÓÖµ<br />
ÜØ´µ<br />
Ò<br />
Ú×Ø´³ÚÖÖÓÖ³µ<br />
This program will be translated into<br />
ÀÌÙÔÐ ÖÖÓÖ<br />
×Ø´ÚÖÖÓÖµ<br />
ÖÖÓÖ ØÖ×ÓдѸ²ÖÓÒ¸½¼¼¸¾µ<br />
´ÖÖÓÖ ¾µ<br />
ß<br />
ÛÖØ×ØÖÒ´ÏÒÓÛÁ¸ÀÌÙÔдÖÖÓÖ ÒÙÑÖ µ · ÀÌÙÔдÖÖÓÖµµ<br />
ÜØ´½µ<br />
Ð<br />
×Ø´ÚÖÖÓÖµ<br />
As can be seen, the operator Ú ÖÖÓÖ ÚÖ is eliminated and replaced by the use of the error<br />
variable later on.<br />
The points mentioned above might cause these two problems:<br />
¯ If the second parameter of Ú ÖÖÓÖ ÚÖ cannot be derived from the program (because<br />
no constant Ð× or ØÖÙ are used but expressions, the value will be interpreted as ØÖÙ,<br />
<strong>HDevelop</strong> / 2000-11-16