468,457 Members | 1,555 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,457 developers. It's quick & easy.

What is Data Type of Vptr pointer

Hi ,
What is the data type of Vptr pointer used in the virtual funtion
mechanism?
i suppose its void. Please correct me if i am wrong...

Regards,
Veeru

Sep 13 '06 #1
7 6500
Veeru wrote:
What is the data type of Vptr pointer used in the virtual funtion
mechanism?
i suppose its void. Please correct me if i am wrong...
Not sure what 'Vptr' you mean. Do you mean 'vtbl'? If so, it is not
defined in C++. It's an ipmlementation detail, and as such has no
representation/definition in C++ proper.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Sep 13 '06 #2

Veeru wrote:
Hi ,
What is the data type of Vptr pointer used in the virtual funtion
mechanism?
i suppose its void. Please correct me if i am wrong...

Regards,
Veeru
your question was answered in Marshall Cline's FAQs

see this..
http://www.parashift.com/c++-faq-lit....html#faq-20.4

-- Murali Krishna

Sep 14 '06 #3

Murali Krishna wrote:
Veeru wrote:
Hi ,
What is the data type of Vptr pointer used in the virtual funtion
mechanism?
i suppose its void. Please correct me if i am wrong...

Regards,
Veeru

your question was answered in Marshall Cline's FAQs

see this..
http://www.parashift.com/c++-faq-lit....html#faq-20.4

-- Murali Krishna
i searched in the FAQ but didnt find the answer to my question. i
wanted to know the data type of the Vptr pointer the points to the
Vbtl(virtual table) which contains the function pointers to virtual
functions.

Please help.

Regards,
Veeru

Sep 15 '06 #4

Veeru wrote:
Murali Krishna wrote:
Veeru wrote:
Hi ,
What is the data type of Vptr pointer used in the virtual funtion
mechanism?
i suppose its void. Please correct me if i am wrong...
>
Regards,
Veeru
your question was answered in Marshall Cline's FAQs

see this..
http://www.parashift.com/c++-faq-lit....html#faq-20.4

-- Murali Krishna

i searched in the FAQ but didnt find the answer to my question. i
wanted to know the data type of the Vptr pointer the points to the
Vbtl(virtual table) which contains the function pointers to virtual
functions.

Please help.

Regards,
Veeru
I think you have faced this in an interview. I have not seen about
VPtr's data-type till now. but as written in FAQs, you can understand
that it is a generic pointer (say void*) to a generic member function
because it stores the starting address of the V-Table.

I guess it is void*.

-- Murali Krishna.

Sep 15 '06 #5

Murali Krishna wrote:
Veeru wrote:
Murali Krishna wrote:
Veeru wrote:
Hi ,
What is the data type of Vptr pointer used in the virtual funtion
mechanism?
i suppose its void. Please correct me if i am wrong...

Regards,
Veeru
>
your question was answered in Marshall Cline's FAQs
>
see this..
http://www.parashift.com/c++-faq-lit....html#faq-20.4
>
-- Murali Krishna
i searched in the FAQ but didnt find the answer to my question. i
wanted to know the data type of the Vptr pointer the points to the
Vbtl(virtual table) which contains the function pointers to virtual
functions.

Please help.

Regards,
Veeru

I think you have faced this in an interview. I have not seen about
VPtr's data-type till now. but as written in FAQs, you can understand
that it is a generic pointer (say void*) to a generic member function
because it stores the starting address of the V-Table.

I guess it is void*.

-- Murali Krishna.

Thanks Murali for such a quick response.
There are two possibilities as far as i can see now:
1. Either Vptr could be a void *
OR
2. V-Table must be some kind of an internal hidden sturture or class.
And the Vptr points to the V-Table. So Vptr could have a data type of
V-Table.

Well, this is just what i can guess.
But still need a confimation.

Regards,
Veeru

Sep 15 '06 #6
Veeru wrote:
>
Murali Krishna wrote:
>Veeru wrote:
Murali Krishna wrote:

Veeru wrote:
Hi ,
What is the data type of Vptr pointer used in the virtual funtion
mechanism?
i suppose its void. Please correct me if i am wrong...

Regards,
Veeru

your question was answered in Marshall Cline's FAQs

see this..
http://www.parashift.com/c++-faq-lit....html#faq-20.4

-- Murali Krishna

i searched in the FAQ but didnt find the answer to my question. i
wanted to know the data type of the Vptr pointer the points to the
Vbtl(virtual table) which contains the function pointers to virtual
functions.

Please help.

Regards,
Veeru

I think you have faced this in an interview. I have not seen about
VPtr's data-type till now. but as written in FAQs, you can understand
that it is a generic pointer (say void*) to a generic member function
because it stores the starting address of the V-Table.

I guess it is void*.

-- Murali Krishna.


Thanks Murali for such a quick response.
There are two possibilities as far as i can see now:
1. Either Vptr could be a void *
OR
2. V-Table must be some kind of an internal hidden sturture or class.
And the Vptr points to the V-Table. So Vptr could have a data type of
V-Table.

Well, this is just what i can guess.
But still need a confimation.
There is no way to confirm this: the c++ standard does not even require that
v-tables exist. In particular, it does not prescribe the types and data
structures used to implement the dispatch mechanism for virtual functions.
Thus, your question does not have a general answer. If you are interested
in how a given implementation does it, then you should ask your question in
a forum dedicated to that particular implementation.
Best

Kai-Uwe Bux
Sep 15 '06 #7
Veeru wrote:
Hi ,
What is the data type of Vptr pointer used in the virtual funtion
mechanism?
i suppose its void. Please correct me if i am wrong...
Your question actually makes no sense - virtual function dispatch is a
language internal feature, and as such has nothing to do with the type
system.

Sep 15 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Thomas Paul Diffenbach | last post: by
100 posts views Thread by E. Robert Tisdale | last post: by
3 posts views Thread by Sathyaish | last post: by
51 posts views Thread by jacob navia | last post: by
21 posts views Thread by tyler_durden | last post: by
13 posts views Thread by ranjeet.gupta | last post: by
4 posts views Thread by pai | last post: by
12 posts views Thread by Robert.Holic | last post: by
4 posts views Thread by grizggg | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.