Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Seeking typical C++ source code. Help please!

1 view
Skip to first unread message

Alan Mackenzie

unread,
Feb 2, 2010, 1:52:07 PM2/2/10
to
Hi, clc++,

Would somebody please recommend some hopefully not too big C++ FOSS
project which contains source which makes liberal use of C++'s features,
in particular templates (ideally both using them and defining them).

I could do with this since I maintain Emacs C++ mode and need a realistic
test file, although I'm hardly a C++ hacker.

Many thanks!

--
Alan Mackenzie (Nuremberg, Germany).

Juha Nieminen

unread,
Feb 2, 2010, 2:15:56 PM2/2/10
to
Alan Mackenzie wrote:
> Would somebody please recommend some hopefully not too big C++ FOSS
> project which contains source which makes liberal use of C++'s features,
> in particular templates (ideally both using them and defining them).

The C++ standard libraries use templates quite heavily, but if you are
looking for smaller examples, here are a few:

http://utfcpp.sourceforge.net/
http://warp.povusers.org/FSBAllocator/
http://warp.povusers.org/FunctionParser/

--- news://freenews.netfront.net/ - complaints: ne...@netfront.net ---

Paavo Helde

unread,
Feb 2, 2010, 2:17:58 PM2/2/10
to
Alan Mackenzie <a...@muc.de> wrote in news:hk9s8n$1pvk$1...@colin2.muc.de:

> Hi, clc++,
>
> Would somebody please recommend some hopefully not too big C++ FOSS
> project which contains source which makes liberal use of C++'s features,
> in particular templates (ideally both using them and defining them).
>
> I could do with this since I maintain Emacs C++ mode and need a realistic
> test file, although I'm hardly a C++ hacker.

Maybe Crypto++ (http://www.cryptopp.com/). This is a very C++-ish library,
lots of templates, derivation and combinations of both.

hth
Paavo

Alan Mackenzie

unread,
Feb 2, 2010, 5:01:32 PM2/2/10
to
Alan Mackenzie <a...@muc.de> wrote:
> Hi, clc++,

> Would somebody please recommend some hopefully not too big C++ FOSS
> project which contains source which makes liberal use of C++'s
> features, in particular templates (ideally both using them and defining
> them).

Juha, Paavo,

Thanks for these bits of software. They're just what I need, as well as
being interesting in their own right.

Jorgen Grahn

unread,
Feb 2, 2010, 7:48:08 PM2/2/10
to
On Tue, 2010-02-02, Alan Mackenzie wrote:
> Hi, clc++,
>
> Would somebody please recommend some hopefully not too big C++ FOSS
> project which contains source which makes liberal use of C++'s features,
> in particular templates (ideally both using them and defining them).
>
> I could do with this since I maintain Emacs C++ mode and need a realistic
> test file, although I'm hardly a C++ hacker.

Then I'm not sure if you should mess around with it too much --
writing code without using it or understanding how people use it is
typically a Bad Idea.

No offense intended, and I'm of course grateful for your work in that
area. It's just that I use c++-mode heavily and am very pleased with
it, arguing that Emacs is the best C++ editor in the world and so on
... I'd hate to see regressions.

I'm also not sure heavily templated code should be the main test
vector. But perhaps you ask for it because you have plenty of plain
C++ code already.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .

Alan Mackenzie

unread,
Feb 3, 2010, 3:14:13 AM2/3/10
to
Jorgen Grahn <grahn...@snipabacken.se> wrote:
> On Tue, 2010-02-02, Alan Mackenzie wrote:
>> Hi, clc++,

>> Would somebody please recommend some hopefully not too big C++ FOSS
>> project which contains source which makes liberal use of C++'s
>> features, in particular templates (ideally both using them and
>> defining them).

>> I could do with this since I maintain Emacs C++ mode and need a
>> realistic test file, although I'm hardly a C++ hacker.

> Then I'm not sure if you should mess around with it too much -- writing
> code without using it or understanding how people use it is typically a
> Bad Idea.

> No offense intended, .....

None taken. :-)

> ...., and I'm of course grateful for your work in that area. It's just


> that I use c++-mode heavily and am very pleased with it, arguing that
> Emacs is the best C++ editor in the world and so on ...

Thanks!

> I'd hate to see regressions.

Not as much as I would hate it. ;-) But there are bugs in C++ Mode to do
with template brackets, and I've just fixed one. I'd like to hammer some
real code with it before I release it. The bug is to do with code like:

if (x < 0 || y < 0 || x >= 9) {

(hi, Kevin!), where C++ Mode can misinterpret < and > as template
brackets if the >= is deleted and reinserted.

It's actually impossible, in the general case to distinguish "template
open/close" from "less/greater than" without doing semantic analysis,
i.e. using a compiler. Who on Earth decided to use these tokens as
delimiters instead of something unambiguous like, say, <{ and }> ?

> I'm also not sure heavily templated code should be the main test
> vector. But perhaps you ask for it because you have plenty of plain
> C++ code already.

Well, see above!

> /Jorgen

0 new messages