Dave's Brain

Browse - Programming Tips - What's your best C/C++ tip?

Date: 1997dec23
Language: C++


Q.  What's your best C/C++ tip?

A.  If there's one single tip that I would give to a fellow C/C++ programmer...
this is it: try out the	Standard Template Library!

Have you ever made a pointer mistake in a link list?  Who hasn't?
As you know, they'll cause memory leaks, crashes or both.  I use link
lists all the time and haven't had any problems like that for a couple
years.  Because, of course, I use the Standard Template Library (stl).

The stl is for managing containers of things.  e.g. link lists, arrays that
can dynamically grow, stacks, queues, associative arrays (maps).  You get the
idea.

MFC has some containing templates like CArray and CList.  CArray isn't too
bad but CList is nuts.  If you are using MFC you can still use the stl.  I do.

Primarily written by Alexander Stepanoy who has working at HP.  He has moved
on to SGI so the site's there.  To install with Borland C++ 4.52 unzip it in
a new directory called C:\BC45\INCLUDE\STL.  Then add this new directory
to the include path for any project that uses it.

http://www.sgi.com/Technology/STL/index.html
http://www.davekb.com/search.php?target=STL

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.