You are not logged in. Please login at to post your questions!


[closed] Update of gcc to 4.8.1

Just submit a solution and notice the change. Now codechef online judge updated to gcc 4.8.1 whereas previously it was 4.3.2.

Notice just one change.

  1. Its taking 0.6 MB of extra memory.

If anybody knows more about the features of this updated version. Feel free to share.

asked 30 Jul '13, 12:19

sobhagya's gravatar image

accept rate: 12%

closed 24 Sep '13, 17:17


I've been waiting for C++11 for so long, finally...! Big thanks to the Codechef team ;) And yet, thanks to bring this up!

(04 Aug '13, 15:27) tyrant2★

The question has been closed for the following reason "The question is answered, right answer was accepted" by sobhagya 24 Sep '13, 17:17

Wow that's great! Codechef has upgraded gcc to latest version :D

But the major reason for upgrading gcc has not been fulfilled. The support for C++11 in "not enabled".

To enable C++11 (previously C++0x), the appropriate flag need to be passed -

g++ -std=c++0x prog.cpp

I made two submissions containing important C++11 features, but they are giving compilation error-

Here is AC submission in gcc 4.3.2 for NUMFACT

I wanted to try range-based for loop, and auto, so I made this submission in gcc 4.8.1. But it is giving following compilation error-

prog.cpp: In function ‘int main()’: prog.cpp:72:14: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat] for (auto &it : m) ^ prog.cpp:72:20: error: ISO C++ forbids declaration of ‘it’ with no type [-fpermissive] for (auto &it : m) ^ prog.cpp:72:25: error: range-based ‘for’ loops are not allowed in C++98 mode for (auto &it : m) ^ prog.cpp:74:24: error: request for member ‘second’ in ‘it’, which is of non-class type ‘int’ ans *= (it.second + 1); ^

The difference-

C++98 (gcc 4.3.2)

    map<int, int> m;
    for (map<int, int>::iterator it = m.begin(); it != m.end(); it++)
        ans *= (it->second + 1);

C++11 (gcc 4.8.1)

    map<int, int> m;
    for (auto &it : m)
        ans *= (it.second + 1);

Another feature I tried - unique_ptr, by submitting to TEST. But again compilation error.


@admin - please add flag --std=c++0x or even better --std=c++11 to compilation with gcc 4.8.1


answered 30 Jul '13, 14:13

vinayak%20garg's gravatar image

4★vinayak garg
accept rate: 18%

@vinayak_garg: We have another language option for C++11 which uses the flag option for gcc. You should submit your code under that language.

(01 Aug '13, 20:08) admin ♦♦0★

@admin: Thanks :) I submitted my codes under C++11 and they got accepted.

(01 Aug '13, 20:18) vinayak garg4★

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 30 Jul '13, 12:19

question was seen: 4,163 times

last updated: 24 Sep '13, 17:17