digitalmars.D.bugs - label idenifers: doc v. compiler
- =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= (22/25) Sep 10 2005 -----BEGIN PGP SIGNED MESSAGE-----
- Hasan Aljudy (3/38) Sep 10 2005 Isn't it always implied that keywords cannot be used for purposes other
- Walter Bright (1/1) Sep 10 2005 Keywords can't be declarations, labels, etc.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 http://digitalmars.com/d/statement.html#labelLabels are in a name space independent of declarations, variables, types, etc. Even so, labels cannot have the same name as *local* declarations.Is a *local* declaration the opposite of an imported declaration? "debug" isn't a *local* declaration, thus the following code is - according to my reading of the docs - legal, whereas the compiler rejects it: void test(){ debug: int dummy; goto debug; } This seems a bid odd and could a source for hard to track bugs. Maybe all keywords from http://digitalmars.com/d/lex.html#keyword should be disallowed as label identifiers? Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDI02q3w+/yD4P9tIRArHIAJ9JPmQj4J6xTiFBNWefsgCABzk/lwCgh6MA 4tvyoTs2iGvH7RfDHIXV/VY= =iJhe -----END PGP SIGNATURE-----
Sep 10 2005
Thomas Kühne wrote:-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 http://digitalmars.com/d/statement.html#labelIsn't it always implied that keywords cannot be used for purposes other than what they are meant for?Labels are in a name space independent of declarations, variables, types, etc. Even so, labels cannot have the same name as *local* declarations.Is a *local* declaration the opposite of an imported declaration? "debug" isn't a *local* declaration, thus the following code is - according to my reading of the docs - legal, whereas the compiler rejects it: void test(){ debug: int dummy; goto debug; } This seems a bid odd and could a source for hard to track bugs. Maybe all keywords from http://digitalmars.com/d/lex.html#keyword should be disallowed as label identifiers? Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDI02q3w+/yD4P9tIRArHIAJ9JPmQj4J6xTiFBNWefsgCABzk/lwCgh6MA 4tvyoTs2iGvH7RfDHIXV/VY= =iJhe -----END PGP SIGNATURE-----
Sep 10 2005
Keywords can't be declarations, labels, etc.
Sep 10 2005