Porting to a new compiler, that doesn't support virtual functions...

C

corner76

Hi all,

I have designed, implemented and tested this code, and it runs
perfectly. Now we're porting it to ARM11, and its compiler doesn't
support virtual function in compination with something that's inherent
in our application and cannot be changed.
So I have to figure out how to implement virtuality myself.

I have a base class (representing a prameter) with some derived classes
(one per paramter type). I have a container of the base class objects,
that uses virtual functions to "work" with the objects.

I tried just using a void * array with one entry per virtual function.
The population is an issue because of type converstions. Then invoking
the methods is impossible without casting to the real type. Well - I'm
in a mess.

Help, anyone?

Thanks!

Keren.
 
G

Geo

Hi all,

I have designed, implemented and tested this code, and it runs

What code ?
perfectly. Now we're porting it to ARM11, and its compiler doesn't
support virtual function in compination with something that's inherent
in our application and cannot be changed.

What 'something' ?

If it doesn't support virtual functions, then it's not a C++ compiler.
So I have to figure out how to implement virtuality myself.

I have a base class (representing a prameter) with some derived classes
(one per paramter type). I have a container of the base class objects,
that uses virtual functions to "work" with the objects.

I tried just using a void * array with one entry per virtual function.
The population is an issue because of type converstions. Then invoking
the methods is impossible without casting to the real type. Well - I'm
in a mess.

Help, anyone?

Get a compiler that compiles C++ code
 
M

makc.the.great

Geo said:
Get a compiler that compiles C++ code

while this is very true,
in C scenario you might try global funcs which accept void *my_this or
something like that.
 
J

Jay Nabonne


I tried just using a void * array with one entry per virtual function.
The population is an issue because of type converstions. Then invoking
the methods is impossible without casting to the real type. Well - I'm
in a mess.

Don't use void pointers. Use real pointer-to-member-functions, each
having the correct signature. Then initialize the pointers in the
individual constructors to point to the right member functions.

- Jay
 

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

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top