void pointer

V

Victor Bazarov

Niks said:
what is a void pointer?

You mean a pointer to void?

A generic pointer, a plain address. That type is returned from 'malloc'
function and from 'operator new', and is accepted by 'operator delete'
as an argument. Usually a pointer to void is used to hold a pointer to
an object of any type or of an unknown type. Has the same alignment
requirements and the same representation as 'char*'. Along with the
requirement that 'void*' can hold a pointer to any object comes the
standard conversion from a pointer to object to a pointer to void. That
conversion is implicit and the reverse can be done using 'static_cast'.

V
 
D

Dan Cernat

Victor said:
You mean a pointer to void?

A generic pointer, a plain address. That type is returned from 'malloc'
function and from 'operator new', and is accepted by 'operator delete'
as an argument. Usually a pointer to void is used to hold a pointer to
an object of any type or of an unknown type. Has the same alignment
requirements and the same representation as 'char*'. Along with the
requirement that 'void*' can hold a pointer to any object comes the
standard conversion from a pointer to object to a pointer to void. That
conversion is implicit and the reverse can be done using 'static_cast'.

V

Can it hold (is it big enough to hold) a pointer to a member function?
I know that the pointers to member functions are implementation
specific, but I was wondering if the standard says anything about this.

thanks,
Dan
 
V

Victor Bazarov

Dan said:
Can it hold (is it big enough to hold) a pointer to a member function?

No. Only a pointer to an object.
I know that the pointers to member functions are implementation
specific, but I was wondering if the standard says anything about this.

It says "A void* shall be able to hold any object pointer."

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top