Advertisement

Weird C++ type conversion problem (HARD)...

Started by September 03, 2000 03:08 PM
74 comments, last by Dire.Wolf 24 years, 3 months ago
quote: Original post by Dire.Wolf

There is always someone better than you out there so that is why I am posting. If you weren''t so socially inept you would understand that people have opinions and are free to express them. Hopefully you will aquire a little more social grace as you grow up or I doubt you will have a very successful professional career.



Hmm, people seem to have this misconception that how one reacts on a public message board is the same as one would react in a more private organization. Anyway, what I was attacking was the almost religious fervor in which you attach yourself to C++ without having the insight to realize or understand the drawbacks and intricacies to programming in said language.

You have done little to either answer my statement or prove that I have underestimated your ability or experience.

MSN
quote:
Hmm, people seem to have this misconception that how one reacts on a public message board is the same as one would react in a more private organization.


Actually how you act in private generally provides better insight into your personal character than the facade you may put on when under scrutiny. The point I was trying to make is that I do not have to prove myself to you - the only person I''m here to impress is myself.

Futhermore, I do not evangelize C++ as the only language that can be used to build successful software solutions. Not once in this thread did I state, "C++ is the only language". I''ve programmed in C since I was 16 - thats 8 years of experience. When I started to approach my software designs using OOA/D techniques I found that C++ helped me express my thoughts and ideas more clearly than C. That is the major reason why I prefer implementing object-oriented solutions in C++ rather than C. C++ supports OOP and generic programming natively - C does not.

Lastly,

Daveb, null_pointer and others show tact and intelligence when they post. When they offer their opinions they also tend to back them up with facts. Unfortunately you do not and therefore are just wasting space in this thread.

How long have you been in the software development industry?

- Dire Wolf
direwolf@digitalfiends.com
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
Advertisement
quote: Original post by Dire.Wolf

Daveb, null_pointer and others show tact and intelligence when they post. When they offer their opinions they also tend to back them up with facts. Unfortunately you do not and therefore are just wasting space in this thread.

How long have you been in the software development industry?



Long enough to know that software development needs to become an engineering discipline in order to meets the demands of reliability customers need.

(In response to your last statement...)
For someone who''s programmed in C++ for 8 years, you know very little about getting templatized assignment operators to work, when you have the STL source for the auto_ptr template (which performs the exact assignment operator you wanted to write). Which, I guess, is proof enough of your grand experience.

I guess I should apologize; I saw your initial post and assumed that you were another hapless newbie that saw the coolness of templates and simply did not understand how to use them properly.

But, since you wanted some further proof that I know what I''m talking about, here goes.

First, you can''t export many of the STL container classes in a .DLL on the Win32 platform on some compiling configurations because each references a different memory allocator, and as such, a different heap. Freeing one object on a different heap will crash the program. Unfortunately, C++ programmers try this all the time, only to bitch and moan when it doesn''t work.

Or how about where does the vtable go when you have a class defined completely in a header file? It can pop-up in all the object files it''s included in since it has no implementation file.

Or why calls to virtual function calls in constructors always call the current class''s implementation rather than the most derived class''s implementation, due to vtable initialization at each constructor.

Or you can eliminate temporaries from arithmentic operator overloading by providing proxy classes (as is done in the blitz++ library) even for matrix multiplication. (BTW, this is tremendously easier with template template parameters.)

Or why the remove(_if) functions do not actually remove anything from an STL container. (This preserve the semantics of the STL exception safety guarentees. If an exception were thrown while removing objects from the container it would be impossible to roll back the operation, unless you don''t remove the objects in the first place.)

Or why for_each is documented as to never modify the container it operates on. (You can, however, this would also violate STL exception safety guarentees for for_each.)

I know what I''m talking about when it comes to C++.

MSN
I never said that I''ve programmed for 8 years in C++ - that is 8 years of experience in C. I said:

quote:
I''ve programmed in C since I was 16 - thats 8 years of experience. When I started to approach my software designs using OOA/D techniques I found that C++ helped me express my thoughts and ideas more clearly than C. That is the major reason why I prefer implementing object-oriented solutions in C++ rather than C. C++ supports OOP and generic programming natively - C does not.


C++ is relatively new to me (about 1 - 1/2 years on and off). Unfortunately most of my time in the last six months has been spent working on Visual Basic applications which hasn''t really helped my C++ knowledge very much. Still, I plug away at C++ on my own and I''ve been using OOA/D methodologies for about 4 years now.

Either way, I''m not going to argue with you anymore. Just watch your step when you climb off your pedestal.

- Dire Wolf
direwolf@digitalfiends.com

[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
BTW auto_ptr does not support:

        auto_ptr<AudioMedia>   audio_media(new AudioMedia);auto_ptr<CDAudio>          cdaudio(new CDAudio); audio_media = cdaudio;        


Good luck getting that to work with an auto_ptr. I must apologize, you really do seem to know what you are talking about...*cough*

- Dire Wolf
direwolf@digitalfiends.com

(board ate my < > )

Edited by - Dire.Wolf on September 7, 2000 9:29:15 PM
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
----
Or how about where does the vtable go when
Or why calls to virtual function calls in
Or you can eliminate temporaries from arithmentic
Or why the remove(_if) functions do not actually
Or why for_each is documented as to never modify
----


Dang! If Bjarne's Internet Troller gets ahold of you, you're in for a tongue lashing!



Edited by - daveb on September 7, 2000 9:52:32 PM
Volition, Inc.
Advertisement
quote: Original post by Dire.Wolf

BTW auto_ptr does not support:

<br><br> <hr height=1 noshade></BLOCKQUOTE></font> <br><br>It works with a standard conforming compiler, which VC++ (I''m assuming from previous posts that''s what you''re talking about) isn''t. Also, the STL provided w/ VC6 does not have the proper assignment operator defined to provide such behavior. Adding that functionality is a little lengthy, but trivial.<br><br>In fact, the solution you desire can be found at http://www.boost.org. Look at the shared_ptr template.<br><br>MSN<br><br>
I have already looked at that and yes, I agree that it is the correct solution (to use member template friends). If you look closely at the shared_ptr implementation you will notice that they do not define friendship to any member template functions and they resort to making the data pointer and reference count pointer public - or am I missing something here?

MSN (or daveb) are there any C++ standard conforming compilers out there? If so, do you have any links?

Thanks,

- Dire Wolf
direwolf@digitalfiends.com
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
quote: Original post by Dire.Wolf

MSN (or daveb) are there any C++ standard conforming compilers out there? If so, do you have any links?



AFAIK, http://gcc.gnu.org/ has the most conforming compiler (GCC merged w/ EGCS, the most conforming compiler out there).

MSN


quote:
Or why the remove(_if) functions do not actually remove anything from an STL container. (This preserve the semantics of the STL exception safety guarentees


This doesn''t have anything to do with exception safety guarantees (which most the algorithms don''t have), it''s simply that remove and its friends are only working with iterators, so they don''t have access to the container to remove anything. If they did, they wouldn''t be as generic because they wouldn''t work with raw arrays.

quote:
and they resort to making the data pointer and reference count pointer public - or am I missing something here?


I haven''t checked, but this is probably to get around the broken template support in VC.

quote:
MSN (or daveb) are there any C++ standard conforming compilers out there? If so, do you have any links?


It''s not fully conforming (I''m not sure if anyone supports export yet) but the Borland Compiler is pretty close.

This topic is closed to new replies.

Advertisement