Re: Crash when using bitset

From: Henrik Stuart (
Date: 02/08/02


On Friday, February 08, 2002 10:53:58 PM Karl B Buchner wrote:
> I'm using bitset for bitvectors in my MUD.  There are
> a few problems i'm running into.  Here's the major one:

When flags->>test(BRIEF) is called on player flags, the mud crashes.
> The following is the call stack:


> #define BRIEF        16
> #define PLRBITS   8


> bitset<PLRBITS> flags;


   Well, your problem is pretty straightforward:
   You have 8 bits and you're trying to see whether number 16 is set.
   Hence, bitset::test throws an exception because you're out of
   bounds - namely std::out_of_range as far as I recall.

   Might want to calculate how many bits you want to use for the usual
   defines. :o)

   Anyway, hope that cleared it out.

Yours truly,
  Henrik Stuart (

   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT