Re: Question about programming techniques



"Andrew V. Shuvalov" <andrew@ecsl.cs.sunysb.edu> writes:

> > I donīt want to reinvent the wheel, definitivly not. I just wanted to
> > know, how to wrap different types into a list, without rewriting
> > everything. Perhaps you can give me a link to some code where you used
> > what you meant.
> >
> > Dirk
> 
>  Yes, it's C++, but you can write absolutely C-style program,
>  without any classes, > but still use all the power of STL. More,
>  it's the best way to learn C++ is to use C++ libs in your C
>  program. One day you realize that you understand how things are
>  made and exploit this power :-)

Excuse me... what 'power'? Aside from the fact that MICO owes much of
its uselessness to STL, you elegantly avoided Dirk's simple question;
and the answer to it is: You can't.

STL forbids mixed-type containers. That, IMHO, disqualifies it from
consideration for serious projects.

Another thing, you can't write C programs that use templates. You can
only write C++ programs that use templates but no other C++ features.
And if you want to link them with C libraries (ones that weren't
compiled with C++ compiler), you have to a) doctor the headers for
extern "C" declarations, b) forget about passing typechecked stuff to
C, and cast everything into void*, c) hope that C++ won't bump some of
the pointers to something you didn't want during the cast.

c), BTW, gave me tons of grief. I was reduced to ripping vtable
pointers out of object records on one occasion. :P Thankfully, I
haven't had to try to compile that stuff with anything other than g++.

	Miro

-- 
I refuse to use .sig



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]