DotGNU Portable.NET - Bugs: bug #19129, Reading uninitialised variable...
You are not allowed to post comments on this tracker with your current authentication level.
bug #19129: Reading uninitialised variable does not cause compile error.
Submitter: | None | ||
Submitted: | Fri 23 Feb 2007 01:43:13 PM UTC | ||
Category: | None | Severity: | 3 - Normal |
Item Group: | None | Status: | None |
Privacy: | Public | Assigned to: | None |
Open/Closed: | Open |
Sat 24 Feb 2007 02:04:58 AM UTC, comment #3: |
Robert Jørgensgaard Olesen <egir> |
Fri 23 Feb 2007 02:59:36 PM UTC, comment #2: Hello,
|
Radek Polak <radekp> |
Fri 23 Feb 2007 02:54:58 PM UTC, comment #1: This violates the soundness of the C# type system. |
Robert Jørgensgaard Olesen <egir> |
Fri 23 Feb 2007 01:43:13 PM UTC, original submission:
Reading uninitialised variable does not cause compile error. I was reading "Programming C#" from Oreley. Example3-2 on page 27 is an example of using an unitialised variable, see attachment. According to "Programming C#" I am suposed to get this error message when compiling:
|
Anonymous |
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Follow 2 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2007-02-23 | egir | Carbon-Copy | - | Added egir | |
2007-02-23 | None | Attached File | - | Added Values.cs, #12030 |
Powered by Savane 3.13-3230.
Corresponding source code
Hello,
I see your point. Semantics are still defined for uninitialized variables and therefore the code is correct seen from the compilers point of view, and soundness is preserved.
However, I do not agree that "my code will work". How should the compiler know which value I need my variables to be initialized with? The original error message was helping the programmer.