Skip to content
Snippets Groups Projects
Commit ace412b5 authored by johti17's avatar johti17
Browse files

Kill C++ Warnings, setting char* to const char*

parent 7fce49ea
No related branches found
No related tags found
1 merge request!4Updates cpp 2023
...@@ -24,10 +24,10 @@ public: ...@@ -24,10 +24,10 @@ public:
class Trace class Trace
{ {
static int indent; static int indent;
char *name; const char *name;
public: public:
Trace(char *s) Trace(const char *s)
{ {
name = s; name = s;
cerr.width(indent); cerr.width(indent);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
// Human-readable representations of token types // Human-readable representations of token types
// //
static char *kTokenTypeNames[] = static const char *kTokenTypeNames[] =
{ {
"uninitialized", "uninitialized",
"number", "number",
...@@ -238,7 +238,7 @@ Token Scanner::Scan(void) ...@@ -238,7 +238,7 @@ Token Scanner::Scan(void)
// multiple-character token. // multiple-character token.
// //
void Scanner::Accumulate(char c) void Scanner::Accumulate(const char c)
{ {
if (position >= kMaxTokenLength) if (position >= kMaxTokenLength)
{ {
...@@ -312,12 +312,12 @@ ostream& operator<<(ostream& s, ScannerError& e) ...@@ -312,12 +312,12 @@ ostream& operator<<(ostream& s, ScannerError& e)
// no argument version returns the type of the token. // no argument version returns the type of the token.
// //
char *Token::Lookup(void) const char *Token::Lookup(void)
{ {
return kTokenTypeNames[type]; return kTokenTypeNames[type];
} }
char *Token::Lookup(TokenType t) const char *Token::Lookup(TokenType t)
{ {
return kTokenTypeNames[t]; return kTokenTypeNames[t];
} }
...@@ -30,11 +30,11 @@ class ScannerError ...@@ -30,11 +30,11 @@ class ScannerError
{ {
public: public:
char errorCharacter; char errorCharacter;
char *message; const char *message;
int state; int state;
ScannerError(char c, int s) : errorCharacter(c), state(s) {}; ScannerError(char c, int s) : errorCharacter(c), state(s) {};
ScannerError(char *s) : message(s) {}; ScannerError(const char *s) : message(s) {};
ScannerError() : errorCharacter(0) {}; ScannerError() : errorCharacter(0) {};
}; };
...@@ -86,8 +86,8 @@ public: ...@@ -86,8 +86,8 @@ public:
double numberValue; double numberValue;
char *symbolValue; char *symbolValue;
char *Lookup(TokenType); const char *Lookup(TokenType);
char *Lookup(void); const char *Lookup(void);
Token() : type(kUninitialized) {}; Token() : type(kUninitialized) {};
Token(TokenType t) : type(t) {}; Token(TokenType t) : type(t) {};
Token(TokenType t, double x) : type(t), numberValue(x) {}; Token(TokenType t, double x) : type(t), numberValue(x) {};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment