This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: quick explanation of genclass(1)?
- To: gcc at gcc dot gnu dot org, reed at reedmedia dot net
- Subject: Re: quick explanation of genclass(1)?
- From: Mike Stump <mrs at windriver dot com>
- Date: Wed, 4 Oct 2000 11:06:39 -0700 (PDT)
> Date: Wed, 4 Oct 2000 00:32:19 -0700 (PDT)
> From: "Jeremy C. Reed" <reed@reedmedia.net>
> To: gcc@gcc.gnu.org
> I am writing an article about esoteric commands and I am trying to
> figure out what genclass(1) is.
Unless you are writing an article for a history book or doing some
sort of software archelogy, please don't. Pretend you never saw it,
forget that you knew anything about it.
In C++ they are called templates. Any introduction book on C++ will
cover templates and what they are.
Your friendly Rosicrucian... :-)
Ok, now onto the answer...
> Can anyone briefly explain, with a sentence or two, in easy-to-understand,
> laymen-terms, what genclass can be used for?
genclass is a macro prcessor that will take a template (generic term,
not the C++ term) of source code and substitute in a parameter or two
into that template and generate a file. For example, if we want a
list of integers, in the old style, we would do:
genclass 'int' val List foo
and then in the file fooList.[ch] you will find the interface and
implementation of that class. There is a builtin list of templates
that you can see with:
genclass -list
In the standard style of C++, one would now do:
#include <list>
list<int> li;
and be done with it. Notice how much easier that is...
> Does it have any current purpose or value?
The only purpose would be to compile software that people are to lazy
to update to conform the the C++ standard that was written ages ago
(~1990) to work with g++.