#2 "may be used without initialisation"


check: binary_search_tree_kernel_1.h
+- line 883

from_left can be used in the while loop below even
without having being initialised. Very easy to solve:

+ bool went_up = false; // true if we went up
the tree from a child node to parent
+ bool from_left = false; // true if we went up
and were coming from a left child node
// find the next element in the tree
if (current_element->right != 0)
// go right and down
temp = current_element;
current_element = temp->right;



  • Davis

    Davis - 2005-11-08

    Logged In: YES

    Lol, I have gotten that warning in visual studio before too.
    The code is actually correct. It isnt ever used when it
    hasnt been initialized because it is only used if went_up
    == true, but in this case it will have been given a value on
    line 905. It isnt obvious that that is the case though.

    I traced it out the first time visual studio told me about
    it only to figure out that it was actually correct. At that
    point I was ticked at visual studio for making me waste my
    time so I left it the way it was. :) But I will change it
    so people dont get this warning anymore.

  • Davis

    Davis - 2005-11-08
    • status: open --> closed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks