brooksmoses: (anime-me)
[personal profile] brooksmoses
So, I discovered something scary this evening, as appropriate for the holiday. (Well, scary, for those of you who know C++, anyhow.)

I was tracking down a segfault in a testcase for our rather heavily template-based C++ library, and decided that the obvious thing was to run it in GDB and have a look at the stack trace.

I present to you just a tiny -- but telling -- piece from the middle of the ten-thousand-character result I got from "where":
  vsip::impl::None_type> > > > > > > > > > > > >, false>::exec

Date: 2007-11-01 05:32 am (UTC)
From: [identity profile] pure-agnostic.livejournal.com
A template 14 layers deep?

Luckily, you can find some utilities on the web which will decode C++ compiler error messages that contain templates.

Date: 2007-11-01 06:51 am (UTC)
From: [identity profile] mayaknife.livejournal.com
Ugh.

I'm always impressed by the tricks that people like Andrei Alexandrescu can do with C++ templating, but it also seems to me that when that much cleverness is required to do what are ultimately relatively simple tasks, then the there's something wrong with the language.

Date: 2007-11-01 08:07 am (UTC)
From: [identity profile] zwol.livejournal.com
Knowing what's going on there, I wonder, if you took that library and reimplemented it in a language with a sane metaprogramming facility ... would it get any more debuggable? I am actually thinking it wouldn't. You might not have the heinous parse-tree-in-the-type-system, but the construct seen by the code generator would still bear only a sketchy resemblance to the source.
Page generated Jan. 20th, 2026 07:46 pm
Powered by Dreamwidth Studios