trace - string::const_iterator end = optflags.end(); for (;...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> #include <limits> #include <vector> using namespace std; #include "trace.h" // // ** BUG IN STL ** BUG IN STL ** // We should use vector<bool> instead of vector<char>, // but vector<bool> has a bug: // http://forums.sun.com/thread.jspa?threadID=5277939 // Static linking works, but doubles the size of the executable // image. // ** BUG IN STL ** BUG IN STL ** // typedef vector<char> boolvec; boolvec traceflags::flags (UCHAR_MAX + 1, false); const boolvec trueflags (UCHAR_MAX + 1, true); string::const_iterator itor = optflags.begin();
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: string::const_iterator end = optflags.end(); for (; itor != end; ++itor) { if (*itor == '@') { flags = trueflags; }else { flags[*itor] = true; } } // Note that TRACE can trace setflags. TRACE ('Y', &quot;optflags = &quot; &lt;&lt; optflags); } // // getflag -// Check to see if a certain flag is on. // bool traceflags::getflag (char flag) { // WARNING: Don't TRACE in this function or the stack will blow up. bool result = flags[flag]; return result; } RCSC(__trace_cc__, &quot;$Id: trace.cc,v 1.2 2010-01-21 18:22:36-08 - - $&quot;)...
View Full Document

This note was uploaded on 01/26/2010 for the course CMPS 109 taught by Professor Bailey,d during the Spring '08 term at UCSC.

Ask a homework question - tutors are online