22.01.2015 Views

HDevelop User's Manual

HDevelop User's Manual

HDevelop User's Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.1. CODE GENERATION FOR C++ 85<br />

that means: “start to use the variable”. To avoid confusion use only the constants Ð×<br />

or ØÖÙ as values for the second parameter.<br />

¯ The usage of a variable starts after the first call of Ú ÖÖÓÖ ÚÖ´ÖÖÎÖиØÖÙµ.<br />

In C++ this means that all successive lines (i.e., lines “below”), until the first<br />

Ú ÖÖÓÖ ÚÖ´ÖÖÎÖиÐ×µ will have the assignment to ÖÖÎÖÐ. This<br />

might lead to a different behavior compared with <strong>HDevelop</strong>, if Ú ÖÖÓÖ ÚÖ is called<br />

inside a loop, because here the operators inside the loop before Ú ÖÖÓÖ ÚÖ might also<br />

use ÖÖÎÖÐ after the second excecution of the loop body. Therefore: Try not to use<br />

Ú ÖÖÓÖ ÚÖ inside a loop. Use it right at the beginning of the program.<br />

4.1.4.2 Compiler errors<br />

Sometimes it happens that messages like<br />

º»ÜÑÔкÔÔ¸ ÐÒ ½ ÓÔÖÒ× ÓÖ ÒØ ÀÌÙÔÐ<br />

or<br />

º»ÜÑÔкÔÔ¸ ÐÒ ½ ÖÖÓÖ ÑÙÓÙ× ÐÐ<br />

º»ÜÑÔкÔÔ¸ ÐÒ ½ Ó× Ó ÀÌÙÔÐÓÔÖØÓÖ ´µ<br />

º»ÜÑÔкÔÔ¸ ÐÒ ½ ÀÌÙÔÐÓÔÖØÓÖ ´ÓÒ×Ø ÀÌÙÔвµ ÓÒ×Ø<br />

º»ÜÑÔкÔÔ¸ ÐÒ ½ ÀÌÙÔÐÓÔÖØÓÖ ´ÓÙе ÓÒ×Ø<br />

º»ÜÑÔкÔÔ¸ ÐÒ ½ ÀÌÙÔÐÓÔÖØÓÖ ´Òص ÓÒ×Ø<br />

are reported by the compiler. Both errors are caused by conflicting operators. In this case one<br />

either has to change the <strong>HDevelop</strong> or the C++ program. To understand how, let us look at the<br />

code which caused the errors above. 1 For the first error the C++ program would look like this:<br />

ÀÌÙÔР̽¸Ì¾<br />

̽ ¾ ̾<br />

Because there is no operator ÒØ ÀÌÙÔÐ a compiler error is given. This error can be handled<br />

in two ways:<br />

1. Do appropriate type casting in C++: ̽ ÀÌÙÔд¾µ ̾<br />

2. Change the order of the Operands in <strong>HDevelop</strong> and export the program again:<br />

̽ ̾ ¾<br />

Both changes will do. The first one would be used by the code generation anyway.<br />

The second error mentioned above is caused by a similar reason. The program might look like<br />

this:<br />

ÀÌÙÔР̽¸Ì¾<br />

ÐÓÒ ÚÐ<br />

̽ ̾ ÚÐ<br />

1 Both concrete errors shown above are hypothetical, as they would be avoided by the automatic code generation<br />

in this special case. But they are good examples for similar errors that might be caused by conflicting operators.<br />

HALCON 6.0

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!