Re: Value type intialization...



Nope; it must be assigned; what you have is comparable to:

int a;
a.ToString();

which fails for the same reason; you /must/ give it a starting value, even
if it is just "new MyStruct();"

Marc


.



Relevant Pages

  • Re: what is wrong?
    ... The only reason you "should" get no output is if the int 21h/47h fails. ... After the "xlatb", ...
    (alt.lang.asm)
  • Re: Creating generic Isolator class for collection modidy inside foreach loop
    ... Marc has provided the reason why this fails, and a fix - but if you're ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Prime Numbers
    ... struct node *next; ... int main ... which testcase it fails which value of i it fails. ... One reason could be ...
    (comp.lang.c)
  • Re: K&R2 1.6 Arrays, exercise 1-13 (vertical histogram)
    ... | int main ... I thought you always initialised variables on declaration, ... This, of course, could have been done by initialising on declaration ... (If the latter reason is true, learning it would have done no good here, because Reason 1 would still have applied.) ...
    (comp.lang.c)
  • Re: Coding inside the debugger
    ... but why isn't the test written so that the reason it fails is ... If something fails in tests like these, ... public void testCreateWithDefaultthrows Exception { ... Ghostworld world = worldWithClass; ...
    (comp.object)

Quantcast