Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
graph-tool
graph-tool
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 40
    • Issues 40
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Tiago Peixoto
  • graph-toolgraph-tool
  • Merge Requests
  • !27

Merged
Opened Jun 06, 2020 by Jeff Trull@jaafarContributor

Remove const qualifier from object that can be modified

  • Overview 4
  • Commits 2
  • Pipelines 2
  • Changes 1

Modifying an object declared const is technically undefined behavior, and compilers are entitled to do as they like with such code. The most likely result - in the event of some future optimizer - would be elimination of the code performing the modification, although it could theoretically be anything.

Given that ConstantPropertyMap defines an assignment operator already, simply changing the underlying data member to non-const (while making it private) seems to achieve the same result as the current code, while avoiding UB.

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Reference: count0/graph-tool!27
Source branch: UB-constness

Revert this merge request

This will create a new commit in order to revert the existing changes.

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.