Checking bad pointers

Started by
25 comments, last by NineYearCycle 17 years, 9 months ago
You only pay for what you use - that is, if you only use a couple of classes from boost, you only have the overhead of those classes in your final program. It's not like using boost::shared_ptr instantly adds 30MB to your .EXE file [wink]


In all frankness, you need to change your views on libraries. The C++ Standard Library is an absolute must (good freakin' luck writing a working C++ program without the C++SL or the legacy C libary). Boost is loaded with stuff that is so useful pretty much any nontrivial C++ program can benefit from at least one boost module - which is why a fair chunk of the library is being considered for official adoption into the standard library.

In general, using other libraries is not bad - quite the contrary, it's good. Reinventing wheels is wasteful, especially in today's world where so many wheels have already been invented and perfected. So many people work on code that it is extremely unlikely that you can do a better job than the collected efforts of dozens (maybe hundreds) of very smart people. Properly using libraries can do incredible wonders for your productivity, and for the power and reliability of your underlying code.


I will grant that it is useful to at least understand how/what your libraries do under the surface; sometimes, that means implementing some things yourself just to see what's involved. But in general you shouldn't use homebrew implementations when highly trusted and extremely reliable alternatives are available for free.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Advertisement
Quote:Original post by Taha Ansari
Isn't boost a big (30 Meg or so) library to be included...


Yes, the library itself is big. But NO the whole library doesn't get included into your program. Only the parts you do use are. Most of the library is contained in header files you include, just list the standard C++ library. A few components are compiled during installation, but this can be disabled if you prefer to explicitely compile them along with your program every time.

Quote:slowing things down a bit


The only thing that may slow down is the compilation time. But that's where precompiled headers help.

Quote:or is it really worth it.


Oh yes, it is really worth it.

Quote:I've heard too many people recommending it though...


And with good reason.

Quote:just dont like the idea of relying on other libraries....hmm.


You are suffering from the Not Invented Here Syndrome. Get over it as soon as possible. Yes, it does mean you will eventually have to learn how to deploy your applications properly, how to deal with DLLs and all that stuff.

<rant> But I guess people here make sure to write their own 3D graphics API and window manager rather than rely on Win32 and OpenGL or DirectX. For the few that dare use them, they obviously leave making sure all the right things are installed up to the hapless user of their game. </rant>

As for Boost itself, it's a de-facto standard collection of C++ libraries, the whole point being to extend the C++ standard library.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Quote:Original post by Taha Ansari
Isn't boost a big (30 Meg or so) library to be included...slowing things down a bit, or is it really worth it. I've heard too many people recommending it though...just dont like the idea of relying on other libraries....hmm.


Hehe. Boost, when you compile all configurations takes more than 1 GB on your hard drive... It also takes a lot of time to compile it (around 2 hours on my old machine).
So, yeah - it is a big library. On the other hand - it is the most useful thing i've ever seen.

By the way, if we are talking about useful libraries - loki is a must have (just like boost).
Convinced with usage of boost, i'm trying to download that right now...I agree that its a must to be completely confident in using already invented libraries.. hope to see a difference soon.

by the way, i never got the precompiled headers to work the magic for me..

Thank you.

[edit:
Quote:Hehe. Boost, when you compile all configurations takes more than 1 GB on your hard drive... It also takes a lot of time to compile it (around 2 hours on my old machine).
You must be kidding!
Quote:Original post by Fruny
Quote:Original post by Taha Ansari
3) smart pointers should be tried, I will google for them..


[boost]


Awesome, I didn't realize we had a forum code for that :)
Quote:Original post by MaulingMonkey
Awesome, I didn't realize we had a forum code for that :)


It's brand new as of today.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Quote:Original post by Taha Ansari
[edit:
Quote:Hehe. Boost, when you compile all configurations takes more than 1 GB on your hard drive... It also takes a lot of time to compile it (around 2 hours on my old machine).
You must be kidding!

He's not. But you don't need to compile everything, so size and time can be reduced.
Quote:Original post by Taha Ansari
...just dont like the idea of relying on other libraries....hmm.


You'll never get far in the industry with kind of thought besides that doesn't really make any sense because it is virtually impossible to not rely on any kind of library (be it third-party or not).
Quote:Original post by Brother Bob
Quote:Original post by Taha Ansari
[edit:
Quote:Hehe. Boost, when you compile all configurations takes more than 1 GB on your hard drive... It also takes a lot of time to compile it (around 2 hours on my old machine).
You must be kidding!

He's not. But you don't need to compile everything, so size and time can be reduced.

Yeah, i'm not kidding! :)
However, it is worth the space and the time it takes.

Offcourse, i could reduce the compile time and the size of compiled libraries (i only use 3-5 libraries right now). I guess i just like to have it all "just in case" (who knows which library i will need tomorow or 5 minutes later). ;)
With this slow internet connection, only 83% of boost (something 1.3.1 .exe maybe) has been downloaded. Also on that page were available its source files and documentation files etc. Would those docs and source etc have to be downloaded as well along with the 9.71 MB .exe file (assumed to be self-extracting)? Hope not. Lets hope all those docs etc. are included in that .exe download.

Thank you

This topic is closed to new replies.

Advertisement