Boost logo

Boost :

From: Bronek Kozicki (brok_at_[hidden])
Date: 2006-07-04 07:02:14


Emil Dotchevski <emildotchevski_at_[hidden]> wrote:
>> - I don't think it's a good idea to have a tag mechanism to access
>> each info field. It's inconvenient having to declare the tag. Of
>> course strings can be abused.. but that's C++. I believe simple
>> string keys are enough and very descriptive and easy to use.
>
> I guess I was overly concerned with abusing strings, but that's
> because in
> my experience as game programmer I've seen strings abused quite often.
> Several people have made similar comments, I think I'm convinced.

Personally I like tags more. Strings have to be not only declared, but
also defined, otherwise one risks suble (and impossible to catch in
compilation) errors like:
  set("fool");
  get("foo1");

Now you see the problem, but if these lines are in two separate
locations (as is often the case with throw ... catch) it will be much
more difficult to diagnose. Futhermore, tags provide nice clue that
there are some data specific to exception being passed - just like
exception hierarchy does. Last but not least, forward declarations have
a nice property that they can be declared in multiple locations (no need
for central location) and compiler will verify that they are used
uniformly.

B.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk