R
Reuven
Guest
i've used the 'simple_name attribute in the following manner:
variable v_my_var : integer;
variable v_line : line;
--- lots of code
write(v_line , v_my_var'simple_name & string'(" = ") );
write(v_line , integer'image(v_my_var) );
writeline(output , v_line);
The benefit is that if the name v_may_var changes, then the write
function calls must also change, and the label in the print statement
keeps in synch with the actual variable name.
If the code was this:
write(v_line , string'("v_my_var' = ") );
write(v_line , integer'image(v_my_var) );
writeline(output , v_line);
and the name v_my_var changed, then nothing ( except the keen eyes of
the coder ) would prevent the printed variable label from remaining
the outdated name. Any comments?
variable v_my_var : integer;
variable v_line : line;
--- lots of code
write(v_line , v_my_var'simple_name & string'(" = ") );
write(v_line , integer'image(v_my_var) );
writeline(output , v_line);
The benefit is that if the name v_may_var changes, then the write
function calls must also change, and the label in the print statement
keeps in synch with the actual variable name.
If the code was this:
write(v_line , string'("v_my_var' = ") );
write(v_line , integer'image(v_my_var) );
writeline(output , v_line);
and the name v_my_var changed, then nothing ( except the keen eyes of
the coder ) would prevent the printed variable label from remaining
the outdated name. Any comments?