Gevik Babakhani wrote:
Advantage of C++ is that it reduce lot of OO code written in C in PostgreSQL, but it is so big effort to do that without small gain. It will increase number of bugs. Do not forget also that C++ compiler is not so common (so good) on different platforms. If somebody interesting in that yes but like a fork ( PostgreSQL++ :-).

Reducing OO code that is written in C is one of my major interests. After
some investigating myself it appears that having the codebase fully
(rewritten in C++ will have an impact on the performance. So I guess such an
effort will result the code being more C++ish and fully OO, being a mixture
in C with some OO taste.

Not sure what "reduce" means here. Is the following really a *worthwhile* reduction?

   Class* object = Class_new(...);
   Class_method(object, ...);
   Class_destroy(object);

Compared to:

   Class *object = new Class(...);
   object->method(...);
   delete object;

Yes, this can sometimes be abbreviated by using stack-based objects:

   Class object (...);
   object.method(...);

Though, this limits capabilities in terms of automatic memory management in terms of passing pointers to object around, or to using a memory area that is cleaned up as a whole "in bulk" once it is no longer required.

STL can help, but it can also hinder.

I'm not convinced that a C++ PostgreSQL would be that much smaller either in terms of source lines of code, or in terms of resulting binary size. Also, it may not run faster. If the method calls are virtual, for instance, and derived classes are used, each method call becomes one more level of indirection.

Better idea is to start to use C99 in PostgreSQL ;-).

I have not investigated this yet. But I am very interested to know what the
advantages would be to "upgrade" the code to C99 standards

The code might look a little bit cleaner, but other than that, I don't see it running faster or being significantly smaller.

Cheers,
mark

--
Mark Mielke <[EMAIL PROTECTED]>

Reply via email to