Noureen Syed
2004-07-13 14:58:40 UTC
As I had asked Jaewook yesterday about what should happen in the case:
int a, b;
a <- 10;
a = a + b;
Jaewook mentioned that we don't care about what b is and basically take
whatever garbage value is in the stack for it and do the addition anyways.
Now depending on that garbage, this would get caught as an error, once type
checking is implemented because we are not adding two integers or maybe it
won't get caught.
Basically, do we need to keep track of whether a variable has been assigned
a value or not before it is used in an expression?
The confusion arises because I was told by Jaewook that I don't need to keep
track of that. However, when a colleague of mine checked with Troy, Troy
mentioned that an error should be generated when "b" is used in the above
example before having a value assigned to it. So that means we keep track of
it now???
Please clarify this.
Thank you.
ns
int a, b;
a <- 10;
a = a + b;
Jaewook mentioned that we don't care about what b is and basically take
whatever garbage value is in the stack for it and do the addition anyways.
Now depending on that garbage, this would get caught as an error, once type
checking is implemented because we are not adding two integers or maybe it
won't get caught.
Basically, do we need to keep track of whether a variable has been assigned
a value or not before it is used in an expression?
The confusion arises because I was told by Jaewook that I don't need to keep
track of that. However, when a colleague of mine checked with Troy, Troy
mentioned that an error should be generated when "b" is used in the above
example before having a value assigned to it. So that means we keep track of
it now???
Please clarify this.
Thank you.
ns