Kuro5hin.org: technology and culture, from the trenches
create account | help/FAQ | contact | links | search | IRC | site news
[ Everything | Diaries | Technology | Science | Culture | Politics | Media | News | Internet | Op-Ed | Fiction | Meta | MLP ]
We need your support: buy an ad | premium membership

[P]
The C++ Programmer's Bag of Tricks

By carbon in Technology
Thu Jul 18, 2002 at 08:36:45 AM EST
Tags: Technology (all tags)
Technology

Developers new to C++ may find themselves unable to do things that used to be facilitated by the built-in standard libraries of another language. Other than the Standard Template Library with which you should already be familiar, C++ does not come with a comprehensive set of general tools and libraries. However, this is where other people's code comes in!

The tools presented here are applicable to many programming tasks, not just to a specific area. They run on many platforms, so more people can use or contribute to your project. They are efficient, actively improved, well documented, and cleanly designed. They are implementations of the wheel to make it easy for you to build a snazzier convertible.

They are just members of the C++ programmer's bag of tricks.


Introduction

C++ isn't perfect, but it can often be the right tool to use for several different types of jobs. C++ has a lot of practical language features, such as templates, functors, operator overloading, pointers, and multiple inheritance. Java, for example, does not implement any of the above things in its current incarnation.

One of the things that Java is better at than C++, however, is providing high-level tools as part of the language itself. Threading, regular expressions, GUIs, and many other features are all inside Java's API. At first glance, a similar set of tools seems to be lacking in C++, as its standard library contains only the bare basics, as well as the STL's useful containers, iterators, and algorithms. For example, C++ does not implement any threading in and of itself, despite threads being an important part of quite a few large projects.

But, C++ does have a large public code repository available for your use at the other end of a Google search. Deciding which of several similar libraries to use can be difficult, and there's always the occasional unpleasant discovery of a library not living up to its own specifications. This article tries to take some of the hard work out of a new C++ developer's life, and list a few projects that are known to be well-built. I've compiled this list partially on my personal experiences, but mostly based on the suggestions of various experienced developers in the Open Projects channel #C++.

So without further ado, the list:

Lua : The extensible extensions language

Lua is a tiny and highly efficient scripting language. It was designed from the very start to do nothing but be used for extending C or C++ programs. Since Lua is written in pure ANSI C, it's extremely portable. But the best feature of Lua may be its unbridled speed.

Lua isn't perfect, and it's C-ness comes at somewhat of a price. It's API is very typical of C libraries, in that all the functions are global and in the form lua_<something>. It uses regular function pointers for call backs, which means that you cannot set a call back to a method of a particular instance without designing around it within the Lua code itself. For example, you could have each call back require a pointer or some other sort of global object identifier, or build some sort of global wrapper around C++'s pointers-to-members.

Lua code itself is written in a clear and easy-to-understand language. I would describe it as a cross between BASIC's syntax and Scheme's first-class functions. It also provides some simplistic object oriented facilities, somewhat reminiscent of Perl's OO. Also, Lua does not have direct access to your C++ code; it can only access the external world through Lua extension libraries and call backs that you provide.

This combination of portability, speed, and simplicity all make Lua useful in a wide range of situations. You could use it in your project which must execute scripts so often that the overhead of larger languages becomes unwieldy. Or, you could use it to allow people without extensive programming experience to still extend your program to fit their needs. You could even use Lua to for either of these features while working on a system where resources are limited or with obscure portability requirements, such as a PDA or embedded network appliance.

So to conclude, Lua is, under many but not all circumstances, a good alternative to larger scripting languages such as Python. If you find Lua is too simple for your needs, though, Python is another good choice for an extensions language. Boost implements a very impressive Python API, allowing it to extend your app in an object oriented fashion. And speaking of Boost...

Boost : The handy library of handy libraries

Boost is probably the largest and most active general purpose C++ library available. It was founded by members of the C++ Standards Committee as a testing ground for new libraries, supposedly for eventual placement into the language itself. Each library submitted to Boost goes under a rigorous testing process before being admitted, and all the ones currently in the library are polished and useful.

Much of Boost is implemented entirely in headers. These usually include simple class constructs that eventually tend to show up, in one form or another, in a number of large projects. For example, there's the noncopyable utility class to prevent certain types from being copied, and the tuple library, a template for holding some specific set of objects in a single container.

Some mathematical libraries are also part of Boost. Cstdint implements some simple number classes, both guaranteed-size integer types which stay the same across different platforms (as with the C header stdint.h), and numbers designed to scale as needed to hold extremely large values. There is also the common factor library for simple LCD and GCD calculations, as well as more complex mathematical concepts like octonions, quaterions, and rational numbers.

There are also Boost libraries for further extending basic C++ features. Smart_ptr contains more flexible and specialized versions of the standard library's auto_ptr, letting you define ownership more precisely. The operators library allows you to have operators built automatically based upon other operators that you've written (for example, automatically defining not-equals based upon equals, or turning less-than and equals into the complete set of comparison operators.) Another useful library is Boost's array, which has a template class designed to give all the efficiency of the fixed C array with additional safety and sanity checks. Even more Boost libs include Static_assert for compile-time assertions, and ref which allows things you couldn't normally do with references, such as feeding them into template algorithms. Also, the concept checking library allows you to more effectively ensure that class interfaces you use and write meet their contracts concerning time complexity, valid expressions, and other such things. And finally, the conversion library provides some primitive conversions that normally require the usage of stringstreams or special library calls to perform.

Boost also contains a regular expressions library. Regular expressions are a powerful way of doing string processing of nearly all kinds besides tokenization, which Boost has a library for as well. The standard C++ library does have some regex-like features (such as the various basic_string find functions), but they aren't comparable to proper regular expression support. Th Boost regex library provides many of the general operations such as match, replace, and split, all of which are dear in the hearts of Perl developers everywhere.

In the Lua section above, I mentioned that Boost had a Python interface. While it's true that Python already comes with a C/C++ API, the Boost Python interface is in a different type of class (if you'll excuse the bad pun) altogether. The regular Python interface permits you to manually control the Python system like any other library, while Boost Python reverses this and allows Python to access and even extend C++ classes as though they were Python classes. It's very easy to grant Python scripts access to your C++ classes, and in doing so you just make it that much simpler for others to expand your code without even having to compile anything.

The final Boost offering I'd like to look at is the thread library, a portable implementation of concurrency. Threading is the thing to use if you want your app to run efficiently across multiple processors, under complex schedulers, with faster responses to new events, or just to separate the real-time and external interface parts of your library. Threading is covered by a wide range of techniques and literature, so if you're familiar with those techniques, consider taking advantage of the Boost thread library's portability and safety.

Believe it or not, there's more. The list of continues with even more useful Boost libraries that aren't discussed above. One of those libraries, any, actually has another Kuro5hin story dedicated entirely to it.

You may find that your use of Boost classes becomes so regular as to make them seem like C++ libraries. This is easy enough to do, since they're built upon the same principles of generic programming and reviewed by many of the same people who set up the C++ standard library. But now that your project is starting to depend upon more complex and powerful external code, it may reach a higher degree of complexity then you expected. If you want to keep track of your overall design, or easily explain your library's API to other developers, you should use a good documentation system, such as...

Doxygen : The comment-parser worthy of comment

Doxygen is an API documentation system, designed in the same style as the documentation systems for Java, Perl, and Python: the docs that are generated are actually based off the comments in your source code. Doxygen has the advantage of being rather more flexible then the majority of such programs. In addition to a wide array of output formats, it can support practically any comment style you'd want to use, including those that work well in the C++ world of separate headers and implementations.

Doxygen isn't only a C++ tool; it works with C, Java, IDL, and PHP, and could probably be extended to others. In addition, it generates not only HTML, but also LaTeX, PostScript, PDFs, and even UNIX man pages. Besides this, it can understand and beautify things like dependencies and collaborations, formulas, and especially detailed and nice-looking versions of the standard class hierarchy diagrams we all love so much. Because the documentation goes right into the relevant source code, it's more difficult to forget to update your docs to match your program's evolution.

Now, your project is really cooking; other coders can use your classes in their projects, and contribute to your own code, because they can easily see what you're thinking of with your design. The next step might be to add network access of some kind, so that something can control or be controlled by your program remotely. One way to do that in a non-platform-specific way is with...

ACE : Adaptive, layered networking which just works

ACE is a collection of components, patterns, and wrappers which give your projects an adaptive way of talking with other networked apps. This is really a gross over-simplification; ACE provides more networking services then you can shake an inheritance tree at, including a related CORBA implementation, its own threading system, signal handling, IPC, message routing, containers, iostreams, a POSIXish OS adaption layer, and far more besides.

To do ACE justice on Kuro5hin would necessitate a separate story altogether, so curious programmers should read the overview, and (after their heads are suitably spinning) work through some tutorials.

But now your project is getting even more complex, especially with the possible introduction of concurrency issues, either via networking or threading. What you really need now is a way of getting rid of all those lingering bugs you can just sense lying beneath the calm waters of your class interfaces (I'm really on a roll with these bad analogies, aren't I?). Luckily for you, there's...

Libcwd : The debugger that helps you help your own code

Libcwd is a debugging support library, which has features like automated memory debugging, runtime support for printing file and line number information, and human-readable demangled typenames. It's thread safe, allows for the creation of multiple debug channels (the named frontends for debugging output) and debug devices (ostreams for actually delivering the debugging data), all of which can be turned on and off dynamically on a per-thread basis. In addition, Libcwd can automatically watch for memory allocations and certain other types of events, helping you to remove memory leaks. What all this allows you to do is to get a real-time display of whatever part of your application you're interested in at the moment, as it runs.

Among all of Libcwd's features, though, perhaps the most useful property of Libcwd is that it's easy to get rid of. When making a release of your application, you can avoid compiling in Libcwd simply by undefining a preprocessor macro and not linking to Libcwd. Since all the actual debugging code is accessed via carefully designed preprocessor macros, compiling your app without them will remove all trace of the any additional dependencies, portability restrictions, and efficiency problems associated with the actual debugging code.

The main disadvantage in using Libcwd is that, in itself, it isn't portable beyond g++, the GNU C++ compiler, and UNIX-ish operating systems, or in some cases only Linux. Your actual release code will be, though, which also means you can simply have some developers use it without affecting the portability of the project's code itself at all. Your developers using Linux will still reap its benefits.

Sponsors

Voxel dot net
o Managed Hosting
o VoxCAST Content Delivery
o Raw Infrastructure

Login

Poll
What do you think of these tools?
o They sound very useful, I'll check them out more closely 32%
o I've already been using some of these in my projects 26%
o I use other tools to accomplish the same tasks these do 3%
o Real Programmers code their own standard libraries 6%
o I don't even like C++, stop bugging me 23%
o I'm not a programmer, what the heck is this stuff? 6%

Votes: 89
Results | Other Polls

Related Links
o Kuro5hin
o Standard Template Library
o Java's API
o a Google search
o Open Projects
o Lua
o API
o language
o Perl's OO
o good alternative
o Python
o Boost
o noncopyabl e
o tuple
o Cstdint
o common factor
o octonions
o quaterions
o rational
o Smart_ptr
o operators
o array
o Static_ass ert
o ref
o concept checking
o conversion
o regular expressions
o a library
o Python [2]
o a C/C++ API
o very easy
o thread
o safety
o even more useful Boost libraries
o any
o another Kuro5hin story
o Doxygen
o LaTeX
o ACE
o CORBA implementation
o overview
o tutorials
o Libcwd
o g++
o Also by carbon


Display: Sort:
The C++ Programmer's Bag of Tricks | 190 comments (172 topical, 18 editorial, 2 hidden)
Whew! That sounds like a lot of work! (3.30 / 42) (#4)
by Steve Ballmer on Thu Jul 18, 2002 at 04:07:47 AM EST

Why not take the fuss out of programming and switch to Visual C# .NET?

Those of you looking to upgrade your programming skills from C or C++ to C# are invited to attend Microsoft's C# Summer Camp from August 19th through 23rd, right here in Redmond!

Each morning kicks off with a general assembly led by the Microsoft C# Development Team. You'll then attend sessions written and taught by the DevelopMentor .NET team of instructors. You'll create your own curriculum, choosing from 36 session titles with tracks ranging from the common language runtime (CLR), XML Web services, and Microsoft ASP.NET. You'll have a chance to try what you're learning and ask questions during scheduled lab sessions with instructors on-hand. By the end of the week, you'll be ready start writing .NET-based applications.

But C# Summer Camp is not all about work--there is plenty of play involved, too. Code competitions, hiking, team sports, golf, and a BBQ cookout are some of the extra-curricular activities you can participate in alongside members of the Microsoft C# team.

C++ sucks (2.66 / 9) (#19)
by marcos on Thu Jul 18, 2002 at 06:47:37 AM EST

And I use C++ as my language of choice. The fact of the matter is that there are things you do in C++ that you should not be doing. Garbage collection, typecasting, playing with ptrs to strings, etc. You can enhance this experience by using such libraries like those described above, but if you learn to use and love a particular set of libraries, and someday have to work somewhere where these libraries are not used, you suddenly become innefficient, and a bit lost.

Nowadays, I never program my UI with C++ any more. Simply too much work. Rather, I encapsulate all low level functionality in COM controls, and do not use any libraries (part from ATL, of course) for the controls. I get code reuse, all the flexibility and power of C++, as well as the ease of use of high level languages to design my UI and user interation with.

Java is a small step in the correct direction, but  it executes way too slow, and requires runtimes that are too bulky and system intrusive.

.NYET will probably take me out of my misery, but the runtimes are simply too big for me to program anything with them. Perhaps in 3 years, when the runtime is finally in every home, I'll get on the  bandwagon.

very useful (3.00 / 2) (#35)
by alyosha1 on Thu Jul 18, 2002 at 09:57:26 AM EST

I haven't used the other tools that you mention, but I find both doxygen and the boost libraries very useful, well designed tools. I now comment all my code doxygen-style by default, and it certainly impresses other people in my group when I present them with a set of web pages completely documenting all my code. First and foremost, however, the STL is the essential tool for any C++ programmer. I'm currently re-writing some of a co-worker's C code in C++, and it's very nice to replace a dozen lines of linked list-handling code with a single std::list<>

err.. (2.75 / 4) (#37)
by turmeric on Thu Jul 18, 2002 at 10:02:25 AM EST

and i suppose doxygen, ace, and libcwd all work perfectly together? no 'oh youre using ACE threads so the output will be meaningless'?

the most important tool in a programmers tool box is her brain, and her ability to communicate with the users.

Just for the record... (4.66 / 3) (#38)
by mcherm on Thu Jul 18, 2002 at 10:38:01 AM EST

Let me say, just for the record, "Thanks for posting this!" It was informative, useful, and technical while still being easy to understand.

-- Michael Chermside
Terrific Article! (4.25 / 4) (#40)
by avdi on Thu Jul 18, 2002 at 10:55:58 AM EST

I use boost, ACE, and Doxygen in just about all my code.  They are excellent tools and these days it's hard to imagine coding without them.  

One correction:  In the ACE section you make it sound like ACE has it's own threading system apart from the OS's (I don't know if that's what you meant, but it came out sounding like that).  ACE merely provides generic wrappers for the native threading system, so that multithreaded code can be written once and compiled on nearly any multithreaded OS.  This really works, too - amazingly well.

ACE is a lot more than that though.  One of the great things that has arisen out of the ACE project is a complementary set of low-level to high-level networking and multithreaded programming patterns, documented in the book Pattern Oriented Software Architecture 2: Patterns for Concurrent and Networked Objects.  These patterns are implemented as adaptable templates in the ACE libraries.

--
Now leave us, and take your fish with you. - Faramir

Some other tools (4.60 / 5) (#41)
by avdi on Thu Jul 18, 2002 at 11:05:55 AM EST

Two other tools which I keep near the top of my bag of tricks:

CPPUnit is a XP-style unit-testing toolkit for C++.

SWIG generates API wrappers from C++ code for Guile, Perl, Python, Ruby, Java, PHP, and others.

--
Now leave us, and take your fish with you. - Faramir

OpenC++ (4.00 / 1) (#42)
by threed on Thu Jul 18, 2002 at 12:04:38 PM EST

Compile-time Reflection / Introspection for C++. Good stuff. OpenC++ Home Page

--Threed - Looking out for Numero Uno since 1976!

Why not Guile (3.00 / 4) (#43)
by unknownlamer on Thu Jul 18, 2002 at 12:05:30 PM EST

Why not use GNU Guile Scheme for an extension language? It's the official extension language of the GNU Project (Guile means GNU Ubiquitous Intelligent Language for Extension). It's under a simple GPL plus exception that allows you to link with Guile and not have to become GPLed (although it will be switching to the LGPL because its bignum support is being replaced with libgmp's faster/better bignums). The 1.4 release is old and crusty, but after a lot of work 1.6 is about to be released. After 1.6 some nice stuff like generational garbage collector and a compiler are being worked on (maybe not a full compiler yet, but the evaluator is being cleaned up to get ready for compilation). Guile is a very powerful dialect of Scheme and using it would allow your user to extend your program in a large number of ways. It has nice things like load-extension that allow the Scheme user to load C extensions into their programs, so your application would become almost infinitely extensible. Of course, you can also use safe and clean modules to create modules that have only "safe" bindings (e.g. no load or unlink).

Because Guile is Scheme, anyone can pick it up very quickly. And because Guile is also the official extension language of GNU (all projects that are extensible must eventually use it if they don't already), when you use Guile you add to the unified feel of the GNU system (and since other applications use Guile users that use those will be able to easily extend your program as well). I think the most important part of Guile is that it is actively maintained so you don't have to worry about it suddenly ceasing to exist (in fact, it has been through several sets of maintainers and is still alive).


--
<vladl> I am reading the making of the atomic bong - modern science
C++ is a solid language contrary to popular belief (4.00 / 6) (#47)
by EXTomar on Thu Jul 18, 2002 at 01:12:50 PM EST

This article is great. I am tired of people being extremely negative about C and C++ and claim nothing good can be written in either language. A lot of mind share, tools and libraries like the ones mentioned, and code has been writen around this "evil language". I've used objects both in ACE and Boost. They are very nicely written and more importantly good objects and example of well writen code.

Beyond this it really bothers me when people say "(language binding A) sucks" or "...rocks" or "...better than sliced bread". Each language has their own banes and blessings(ignoring any political/monetary issues). No one language (yet) has solved the universal Comp Sci problem of perfectly expressing the programmer's wishes in all situation(hardware, execution environment etc.). To excell in feature often another must be muddled. No matter how cool you think C# maybe it lacks ease and style Perl excells in(example: find all files that match a variable filename format X through Z, replace text A with B if the filename is X.A or replace text C with D if the filename is X.D). It is possible to write such a task in C# but it is not nearly as elegant as the Perl version would be. In short: given a task pick a language where its feature's strengths are maximized.

Saying this, C and C++ are set apart from other languages, besides their age, by the fact that the syntax is so tied to pointer usage which ties it directly to the execution platform. This is extremely handy in some cases and a pain others. If you want to move image bits from one place to another, changing the red color channel then C/C++ can do this efficiently where other languages would not. This strength is also a weakness since systems represent pointers differently and therefore behavior will be different.

There is nothing in C/C++ that stops other paradyms from being applied. I can't think of an OO construct that can be built in C++. XP style can be applied to code. Streams, pipes and other wacky data types are implementable in C and C++. Features like Garbage Collecting that are lacking in C/C++ have turned out to be not such a "magic bullet". Programmers are still writing mismanaged obfuscated code but in different ways. Debugging code that has poorly constructed try/catch blocks can be as much of a pain as figuring out memory leaks. "Write once/Run everywhere" isn't exactly a magic bullet or as important as people thought.

In short, no language "sucks" outright. Some are just not as good at a given task as others. This is not a reason to harp on it.



ACE (2.33 / 3) (#49)
by onservat on Thu Jul 18, 2002 at 01:21:18 PM EST

Perhaps it's been fixed since, but when I last looked at ACE a couple of years ago, it was unusable owing to its completely amateurish approach to error handling. Avoid.

Word of warning (4.00 / 1) (#50)
by ucblockhead on Thu Jul 18, 2002 at 01:22:11 PM EST

The boost library is generally good, but the regular expression library is very slow. Don't attempt to use it (as I did) in a performance critical part of a program.
-----------------------
This is k5. We're all tools - duxup
obligatory "you misrepresented java" pos (3.80 / 5) (#59)
by zzzeek on Thu Jul 18, 2002 at 02:43:42 PM EST

C++ has a lot of practical language features, such as templates, functors, operator overloading, pointers, and multiple inheritance. Java, for example, does not implement any of the above things in its current incarnation.
Since the Java language operates off of different development paradigms than C++, the functionality granted by the above features is often provided in a different way. I don't often hear of Java programmers complaining that the language is in need of these features (with the possible exception of templates). I think usually someone transitioning from the C++ paradigm to the Java paradigm would miss those features until he/she learns more about the ideologies and techniques that go into Java application design.

Templates are less necessary (though some people still desire them) since every object in Java derives from the base class Object and any kind of library, such as the standard collection classes, can deal with passing every kind of object (and native types wrapped in objects, to the chagrin of some) based on the Object superclass. The main argument for templates is that there is a slight performance hit associated with all the casting this introduces. Java likes to choose simplicity over small performance increases, quite often (*shrug*).

Saying Java doesnt have "pointers", at least to me, implies that you are unable to refer to objects by reference, which isnt true; it would imply that you can't even build basic data structures in Java. Everything in Java, other than the native types, are referred to by reference, so nearly everything is a "pointer". You can't do pointer arithmetic, since its against the spirit that Java was created in (i.e., despite the neat performance and bloat-reducing tricks you can do, its a huge source of confusing and/or broken code).

Multiple inheritance is not present in the way it is in C++, i.e. a class can not derive itself from more than one superclass, but it does support multiple interface implementation, which is an essential technique in Java. Many programmers would argue that this is the only kind of multiple inheritance that you really need, as anything more elaborate (actually having code and method implementations behind those inherited interfaces) becomes confusing and unworkable.

My impression of operator overloading is that it finds a lot of usage in things like writing objects that do reference counting for garbage collection purposes. Since Java VM's do garbage collection automatically, this is probably why its not a very important language feature in Java.

But functors, well im not a C++ guy so I will humbly admit that I don't even know what that is. :)



Java weenies whining about C++ (4.00 / 5) (#78)
by marcos on Thu Jul 18, 2002 at 04:17:28 PM EST

This isn't addressed towards the article, but towards the comments.

One of the most annoying things in the world is when programmers come fresh out of college, and because they have only learnt Java, and it is the only language they are somewhat intimately familiar with, claim that it is the greatest language in the world, and live the rest of their lives comparing all other languages to Java.

Get it through your head now, different languages are there for different purposes. C++ is an excellent language once you are familiar with it, and the syntax is also good.

And I hate those oldtimers who say that C++ is bloated hackfleisch language, and that C is the reincarnation of Jesus come to save us all. C is out. Nobody listens to techno.

Admit it, you just are not flexible enough to learn a new language, that is why you cannot move on from C. In the same way, you college graduates who insist on using only Java, Earth to you, its time to make your way down. And we'll hang out a sign - welcome to the real world, Java is bloated and slow, and nobody uses Java.

Java advocates who deride C++ are going to land in VB purgatory. Believe in C++, and you shall enter programmers heaven. Amen.

COBOL (3.00 / 1) (#109)
by vambo rool on Thu Jul 18, 2002 at 07:03:02 PM EST

Here's something to consider when arguing about the microshare of the market that one language or another has. Read this all the way through. It's fascinating.
Consider these facts from industry watchers: 70 percent of the world's data is processed by COBOL and nine out of 10 ATM transactions are done using COBOL. Thirty billion online COBOL transactions are processed daily; 492 of the Fortune 500 use COBOL, including the entire Fortune 100, and current COBOL investment tops $3 trillion. You get the idea--these legacy systems still have an important role to play in business today.


Also: zlib, libpng (4.50 / 2) (#117)
by SeanReardon on Thu Jul 18, 2002 at 07:56:20 PM EST

At my work we make extensive use of zlib and libpng.  Both have proven extremely useful.

We made aggressive use of zlib in our port of Half-Life to the ps2 (smaller data files == less time waiting on a read to complete).

I'm pretty sure we are still using the png image format for some of the textures in our bond game.

Trolling (2.50 / 2) (#122)
by sypher on Thu Jul 18, 2002 at 08:43:27 PM EST

Discredits the content of the article, i dont have the first clue about C other than knowing what it is.

I enjoyed the article but suddenly wonder what basis the original and the ILT have for differential.

Who to believe if i have no idea of what C is?

Yesterday my diary went on about trolls ruining the discussion, i see their maniacal antics in my hidden comments, if they are there for two days running, kill the fscking account already.

I dreamt of it once, now I fear it dreams of me
ICI (4.75 / 4) (#125)
by tpv on Thu Jul 18, 2002 at 10:33:22 PM EST

So to conclude, Lua is, under many but not all circumstances, a good alternative to larger scripting languages such as Python

Another alternative would be ICI.

Small, full-featured,fast, free.
It is designed to be usable in embedded situations, so it is very small.
It has regexp support, full programmng constructs, OO, etc.
Initial testing on version 4 (soon to be released) indicates it is faster than perl, python and ruby (although as always YMMV).
ICI is in the public domain.

I'm quite fond of ICI, but obviously is isn't the solution to all tasks. It has less modules than perl/python/ruby, and the syntax may not appeal to everyone.
--
"...More [people] have been bombed from the air than have flown ...modernity as a cultural outlook remains a rarity, leaving post-modernism a

Another cool tool (and book) (4.50 / 2) (#150)
by voltron27 on Fri Jul 19, 2002 at 12:08:10 PM EST

Greetings,

Another thing I've found highly useful is Loki (available at sourceforge.net/projects/loki-lib. This is a generic-design and pattern-oriented c++ library.

The library is very good, providing singletons, functors, smart pointers, factories, visitors, and multimethods. However, what is even better is reading the book, which is where the code really comes from. This book is "Modern C++ Design" by Alexandrescu. I suggest every C++ programmer run out and buy it right now. The book focuses on generic programming techniques with c++.

Before reading this book, I was frightened of templates. See, when I learned c++, template support was really bad, and the professor basically said, "well, don't worry about it." Templates are now pretty well supported all around, but using them? That's another question. If you were like me, and you really don't dig templates oh so much, do yourself a favor: get the book, get the code, and study both. Both have made my code much, much more...interesting (and better, too :)

valgrind (none / 0) (#156)
by j1mmy on Fri Jul 19, 2002 at 04:15:59 PM EST

valgrind  finds memory management problems. I still use memprof for leak-checking (the gui is nice), but valgrind can root out tons of other errors. It looks like libcwd does some similar things, but valgrind is completely standalone -- no need to recompile or link against anything.

The C++ Programmer's Bag of Tricks | 190 comments (172 topical, 18 editorial, 2 hidden)
Display: Sort:

kuro5hin.org

[XML]
All trademarks and copyrights on this page are owned by their respective companies. The Rest © 2000 - Present Kuro5hin.org Inc.
See our legalese page for copyright policies. Please also read our Privacy Policy.
Kuro5hin.org is powered by Free Software, including Apache, Perl, and Linux, The Scoop Engine that runs this site is freely available, under the terms of the GPL.
Need some help? Email help@kuro5hin.org.
My heart's the long stairs.

Powered by Scoop create account | help/FAQ | mission | links | search | IRC | YOU choose the stories!