[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Variable Initialization and Variable Hiding
Hi, I have a few questions about variable initialization and variable name hiding. Although I have my answers to them, I would like to know what you think because they are somewhat counter-intuitive in my opinion. Case 1: Description: scope S1 variable v1=101 scope S2 variable v2=v1 variable v1=201 Is this legal? If legal, will v2 be 101 or 201? My answer: As per 9.1 Variables, variable v2=v1 variable v1=201 should be conceptually equivalent to variable v2 variable v1 sequence assign v1 -> v2 assign 201 -> v1 Therefore, an uninitializedVariable (v1) fault should be raised. Case 2: Description: scope S1 variable v1=101 scope S2 variable v1=v1 Is this legal? Will an uninitializedFault be raised? My answer: As per 9.1 Variables, variable v1=v1 should be conceptually equivalent to variable v1 sequence assign v1 -> v1 Therefore, an uninitializedVariable (v1) fault should be raised. Yuzo Fujishima NEC Corporation
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]