Re: Crash when using bitset

From: Henrik Stuart (hstuart@geocities.com)
Date: 02/08/02


Greetings,

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:

[snip]

> #define BRIEF        16
> #define PLRBITS   8

[snip]

> bitset<PLRBITS> flags;

[snip]

   Well, your problem is pretty straightforward:
   You have 8 bits and you're trying to see whether number 16 is set.
   :o)
   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 (http://www.unprompted.com/hstuart/)

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



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