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 […]
error: format ‘%p’ expects argument of type ‘void *’, but argument 2 has type ‘int *’ [-Werror=format=]
Compiling the below code without gcc flags doesn’t raise any errors but does when I use -Werror
, I have been printing memory address with %p flag but apparently I now have to typecast to void*
to use the %p
flag, what’s the required flag to print integer pointers as %ls
suggested by the compiler isn’t supported in ISO C90?
error: format ‘%p’ expects argument of type ‘void *’, but argument 2 has type ‘int *’ [-Werror=format=]
Compiling the below code without gcc flags doesn’t raise any errors but does when I use -Werror
, I have been printing memory address with %p flag but apparently I now have to typecast to void*
to use the %p
flag, what’s the required flag to print integer pointers as %ls
suggested by the compiler isn’t supported in ISO C90?
error: format ‘%p’ expects argument of type ‘void *’, but argument 2 has type ‘int *’ [-Werror=format=]
Compiling the below code without gcc flags doesn’t raise any errors but does when I use -Werror
, I have been printing memory address with %p flag but apparently I now have to typecast to void*
to use the %p
flag, what’s the required flag to print integer pointers as %ls
suggested by the compiler isn’t supported in ISO C90?
Am i missing something about pointers?
i’m actually in tech school and i studied about pointers but there are little misunderstood about that.
Am i missing something about pointers?
i’m actually in tech school and i studied about pointers but there are little misunderstood about that.
Am i missing something about pointers?
i’m actually in tech school and i studied about pointers but there are little misunderstood about that.
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 […]