By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,904 Members | 1,302 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,904 IT Pros & Developers. It's quick & easy.

Alternate implementations

P: n/a
Hi all,
May be this question is less related to C++ language and more to
implementations. I was just curious to know -

1) Is there a compiler which implements virtual functions by a
mechanism *other than* the typical vtable and vptr mechanism? If yes,
how?

2) Is there a compiler which implements references by a mechanism
*other than* treating them as constant pointers? If yes, how?

3) Are there any other such non-usual aspects of some implementation?
(i.e. a concept which is implemented by 99.99% compilers in some way
but is implemented in a completely different way by some compiler)

Thanks
Neelesh

Nov 9 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Neelesh wrote:
May be this question is less related to C++ language and more to
implementations. I was just curious to know -

1) Is there a compiler which implements virtual functions by a
mechanism *other than* the typical vtable and vptr mechanism? If yes,
how?
That I don't know, so I'll skip that one.
2) Is there a compiler which implements references by a mechanism
*other than* treating them as constant pointers? If yes, how?
Every compiler _can_ (and probably does) implement references differently
depending on the context in which they are declared. A reference to
an object in the same scope as the reference is probably not implemented
as a constant pointer at all, and is replaced by the same object anywhere
the reference is used. That is a compile-time decision that can be made
and is probably made.

References which are initialised differently depending on some run-time
condition, are probably always implemented using an address of sorts (what
you call a constant pointer).
3) Are there any other such non-usual aspects of some implementation?
(i.e. a concept which is implemented by 99.99% compilers in some way
but is implemented in a completely different way by some compiler)


There aren't enough compilers out there to make even one of them to be
0.01% of all compilers. If one of the compilers implements something
"differently", it would still be in single digits percent, most likely.
For example, Comeau C++ implements 'export'. Nobody else does (or did
until very recently, and I've not heard of another implementation of the
'export' keyword), which makes significantly more than 0.01% of compilers
who do implement 'export'. Although, if you count those percent from the
number of _compiler_installations_ out there, it could be different...

V
Nov 9 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.