Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8345580

Remove const from Node::_idx which is modified

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 24
    • hotspot

      Node::_idx is declared as const but it is actually modified by the setter Node::set_idx.

      First, this is counterintuitive when reading the code as the reader will assume the variable can never change from only seeing the declaration.

      Second, this causes undefined behavior in Node::set_idx as per the C++ standard (section 7.1.6.1.4 for C++14).

            yeren Yagmur Eren
            tweidmann Theo Weidmann
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: