the standard and data member value assignment

Discussion in 'C++' started by Christopher, Sep 12, 2003.

  1. Christopher

    Christopher Guest

    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
    Christopher, Sep 12, 2003
    #1
    1. Advertising

  2. "Christopher" <> wrote...
    > 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
    Victor Bazarov, Sep 12, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. CoolPint
    Replies:
    5
    Views:
    387
    osmium
    Aug 15, 2003
  2. nagy
    Replies:
    36
    Views:
    986
    Terry Reedy
    Jul 20, 2006
  3. Jason
    Replies:
    2
    Views:
    495
    Jonathan Mcdougall
    May 13, 2006
  4. Stephen Howe
    Replies:
    2
    Views:
    282
    Stephen Howe
    Nov 6, 2012
  5. somenath
    Replies:
    10
    Views:
    265
    James Kanze
    Jul 2, 2013
Loading...

Share This Page