[Mono-bugs] [Bug 398325] [PATCH] Use of unassigned local variable not recognized for variables declared after end of scope of an assigned variable

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Jun 22 07:46:56 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=398325

User harinath at hurrynot.org added comment
https://bugzilla.novell.com/show_bug.cgi?id=398325#c7





--- Comment #7 from Raja Harinath <harinath at hurrynot.org>  2008-06-22 05:46:55 MDT ---
Hmm, I think the new version is worse, since it breaks one of the main reasons
of MyBitVector.

So, the bugfix is to use this code in the "copy"-constructor below the

  shared = InheritedFrom.Shared;

line:

  if (count > InheritedFrom.Count && shared.Count > InheritedFrom.Count) {
    vector = new Bitarray (shared); shared = null;
    // clear tail
    vector.Length = InheritedFrom.Count;
    // reset
    vector.Length = Count;
  }

However, we'd want to avoid the allocation in 'InheritedFrom.Shared' where not
necessary. So, it's probably way cleaner to refactor

  BitArray MyBitArray::Shared { get; }

to

  BitArray MyBitVector::MaybeShare (int count);


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list