Could I find some translator which could translate partial C++ codes
to equivalent C codes? like

int max(int A, int B);
double max(double B, double B);

would be translate to something like

int maxInt(int A, int B);
double maxDouble(double B, double B);
template<typename T = int, double, char>
T max(T A, T B);

would be translate to something like

int maxInt(int A, int B);
double maxDouble(double B, double B);
char maxChar(char B, char B);

Or I should write one for myself?
Ok, I know that I should use C++ if I like it
but I can't choose it by my free will
I have to design something like qsort if I have to use C
and it is what I am refuse to.That kind of codes are not
efficient at all but hard to debug and maintain.
But it is even harder to maintain if I don't design a
"partial generic" function by the way like that.

Recommended Answers

All 3 Replies

Comeau may help. I never looked at the generated C code; it may well be unreadable by a human being.

Thanks, I will take a look at Comeau.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.