The picture below is an example of a FB call.
The TEMP field has been highlighted and in the TEMP area 5 variables have been assigned.
I have highlighted the address field, these show that each TEMP tag is assigned the number of bytes required, depending on the number of bytes/bits to make up the data type.
The first is a double word, whose address is give as 0.0, the second is also a double word whose address starts at 4.0. It starts at 4.0, because the first TEMP takes 4 bytes, 0, 1, 2 and 3.
The example show that the TEMP tags take up in total 21 bytes, the last starting at 20.0 and this being a word (2 bytes).
Therefore before starting to program the block, the block has already reserved the first 21 local flag bytes for TEMP tags.
These must be assigned a value in the code within the block before they are used, example.
You cannot program L #t_Ret_Val_Int, without first transferring a value into it. It will not remember what was in it after the last scan. As it is a scratch flag, it could be used in other blocks and overwritten with another value.
You could if you wanted address it directly, such as T LW 18, this would be exactly the same as T #t_Ret_Val_Int, because #t_Ret_Val_Int address starts from 18.0.
If you modify the code as below
and add a new TEMP flag, in this case a BOOL, it will automatically take 2 bytes and move all the temp flag addresses after it.
#t_Ret_Val_Int is now 20.0, therefore if you used it as T #t_Ret_Val_Int it would be OK, the address is automatically updated, if you addressed it T LW 18, it is now incorrect and is now overwritting the end of an ANY pointer, which could have dire consequences in your code.
If you had directly used LW 22 before the change, which you can, that too would now be incorrectly addressing, in this case #t_RETVAL_word.
If you directly address an L flag, the Step7 editor does automatically warn you to check addresses.