the standard and data member value assignment

C

Christopher

I have been told to complete an assignment in a linux enviroment. I don't
have it so I started up my copy of VS. I am not allowed to alter the files
supplied to me, but only to implement the blanks, blah. well the instructor
made the following statement:

class foo
{
public:
const int MAX_DATA_SIZE = 30;
// ...snipped
};

my compiler doesn't like that idea and gives me an error regarding the
assignment of a value there.
so my question is: what does the standard have to say about the line in
question so that I can justify
my remaking it into a #define or not?

Thanx,
Christopher
 
V

Victor Bazarov

Christopher said:
I have been told to complete an assignment in a linux enviroment. I don't
have it so I started up my copy of VS. I am not allowed to alter the files
supplied to me, but only to implement the blanks, blah. well the instructor
made the following statement:

class foo
{
public:
const int MAX_DATA_SIZE = 30;
// ...snipped
};

my compiler doesn't like that idea and gives me an error regarding the
assignment of a value there.

Outdated compiler. Nothing you can do about it, really.
so my question is: what does the standard have to say about the line in
question so that I can justify
my remaking it into a #define or not?

The Standard says it's allowed.

If you aren't supposed to change anything that is already there,
find a better compiler. MinGW should do it (it's basically GCC).

Victor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top