* Ossama Othman said: > > > Simple. :-) > > Perhaps, but not clean. And doesn't make sense in this particular case... > > Remember the rule of the Ockham's Razor???? I think it should be obeyed > > here... > > What's not clean about it? It's a very simple wrapper? Also, what > doesn't make sense? It has been taken out of context so you don't know > what it is used for but it conveys the general idea, I think. I'm Oh, you got me wrong :)) I wasn't talking about the code itself :)). I just don't see any point in creating a C++ library just to create a C wrapper, so that C programs and, say, scripting languages can use it. It is MUCH easier to write it in C at once, especially when nothing justifies using C++. I mean, you can buy a small car - a "shopping bag on wheels" and then buy a new engine just to be able to tow a trailer :)) - it is possible, but not cost-effective and sensible - you can buy a larger and stronger car at once :)). Maybe the example isn't perfect, but it shows what I have in mind :)). In other words - why create TWO libraries instead of one? Writing the code in C++ would result in: 1. having a c++ library 2. having a C-wrapper library to interface the C++ one ('cause it doesn't make sense to put the C wrappers inside the C++ library) 3. Most programmers would write code in C, linking against the wrapper library wich, in turn, would load the C++ library and the latter would pull in libstdc++ and whatever else is needed. Imagine how much memory space is wasted? The C program that starts the chain, doesn't need all the C++ bloat behind the scenes... > afraid I don't recall what Ockham's Razor says. :-) Could you please > let me know? It's a rule created in XVII-th century that says that, in simple words, every theory, experiment or research should be as simple as possible - without adding too much unnecessary stuff. It may be possible to achieve a goal in two ways, but always one of them is simpler and equally correct as the second one - Ockham's Rule says "chose the simpler approach, the simpler the better" regards, marek
Attachment:
pgpgvo2zkDSCT.pgp
Description: PGP signature