But you're not actually using that pointer in the code, so I fail to see how that's undefined behaviour. An invalid pointer which isn't used still doesn't cause any runtime issues, or is there something about that too in the standards?
The last increment of the pointer is when it has an undefined value, producing undefined behavior.
For example it might behave like a trap representation.
Regardless, the program cannot be reasoned about after this point. :)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
But you're not actually using that pointer in the code, so I fail to see how that's undefined behaviour.
An invalid pointer which isn't used still doesn't cause any runtime issues, or is there something about that too in the standards?
The last increment of the pointer is when it has an undefined value, producing undefined behavior.
For example it might behave like a trap representation.
Regardless, the program cannot be reasoned about after this point. :)