Relative Content

Tag Archive for c++pointers

C++ pointer in const object can call non-const function [duplicate]

This question already has answers here: Why can I call a non-const member function pointer from a const method? (5 answers) Propagate constness to data pointed by member variables (4 answers) Closed 3 days ago. I have a situation that a const object that has a pointer member is able to call a non-const function […]

C++ pointer in const object can call non-const function [duplicate]

This question already has answers here: Why can I call a non-const member function pointer from a const method? (5 answers) Propagate constness to data pointed by member variables (4 answers) Closed 3 days ago. I have a situation that a const object that has a pointer member is able to call a non-const function […]

Is it UB immediately assigning an invalid address to a pointer? [duplicate]

This question already has answers here: Can I assign any integer value to a pointer variable directly? (5 answers) Closed 16 days ago. This question applies to both C and C++. I always thought it was OK to assign any value to a pointer, as long as when you dereference that pointer that it points […]

Is it UB immediately assigning an invalid address to a pointer? [duplicate]

This question already has answers here: Can I assign any integer value to a pointer variable directly? (5 answers) Closed 16 days ago. This question applies to both C and C++. I always thought it was OK to assign any value to a pointer, as long as when you dereference that pointer that it points […]