The following code prints 0
with GCC 4.8.1 (why not) but 10
with MSVC2013 (why?):
#include <iostream>
#include <vector>
const int y = 10;
int main()
{
std::vector<double> y(y);
std::cout << y.size() << std::endl;
return 0;
}
The following code prints 0
with GCC 4.8.1 (why not) but 10
with MSVC2013 (why?):
#include <iostream>
#include <vector>
const int y = 10;
int main()
{
std::vector<double> y(y);
std::cout << y.size() << std::endl;
return 0;
}
i think you need compile with
warning level 4 or warning is an error
in visual studio and
-Wall and -Werror or -Winit-self or -Wuninitialized
for ggcc.
That compile, but you have an allocation problem.
For me the best flags are :
-std=c++11 -pipe -m64 -ansi -fPIC -g -O3 -fno-exceptions -fstack-protector -Wl,-z,relro -Wl,-z,now -fvisibility=hidden -W -Wall -Wno-unused-parameter -Wno-unused-function -Wno-unused-label -Wpointer-arith -Wformat -Wreturn-type -Wsign-compare -Wmultichar -Wformat-nonliteral -Winit-self -Wuninitialized -Wno-deprecated -Wformat-security -Werror