This is C++11 code, as some compilers rightfully note when restricted to C++98:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
test.cc:4:25: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
constint SCREEN_WIDTH = 640;
^
test.cc:5:26: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
constint SCREEN_HEIGHT = 480;
^
test.cc:6:23: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
constint SCREEN_BPP = 32;
^
test.cc:11:23: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
SDL_Surface* message = NULL;
^
test.cc:12:18: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
SDL_Surface* BG = NULL;
^
test.cc:13:22: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
SDL_Surface* screen = NULL;
^
6 warnings generated.
ken@ken-desktop:~/Documents/SRC/SDL$ g++ -o optimized optimizeloadandblit.cpp -lSDL
optimizeloadandblit.cpp:12: error: ISO C++ forbids initialization of member ‘SCREEN_WIDTH’
optimizeloadandblit.cpp:12: error: making ‘SCREEN_WIDTH’ static
optimizeloadandblit.cpp:13: error: ISO C++ forbids initialization of member ‘SCREEN_HEIGHT’
optimizeloadandblit.cpp:13: error: making ‘SCREEN_HEIGHT’ static
optimizeloadandblit.cpp:14: error: ISO C++ forbids initialization of member ‘SCREEN_BPP’
optimizeloadandblit.cpp:14: error: making ‘SCREEN_BPP’ static
optimizeloadandblit.cpp:15: error: uninitialized const ‘ScrAt’
optimizeloadandblit.cpp:19: error: ISO C++ forbids initialization of member ‘message’
optimizeloadandblit.cpp:19: error: making ‘message’ static
optimizeloadandblit.cpp:19: error: invalid in-class initialization of static data member of non-integral type ‘SDL_Surface*’
optimizeloadandblit.cpp:20: error: ISO C++ forbids initialization of member ‘BG’
optimizeloadandblit.cpp:20: error: making ‘BG’ static
optimizeloadandblit.cpp:20: error: invalid in-class initialization of static data member of non-integral type ‘SDL_Surface*’
optimizeloadandblit.cpp:21: error: ISO C++ forbids initialization of member ‘screen’
optimizeloadandblit.cpp:21: error: making ‘screen’ static
optimizeloadandblit.cpp:21: error: invalid in-class initialization of static data member of non-integral type ‘SDL_Surface*’
optimizeloadandblit.cpp: In function ‘int main(int, char**)’:
optimizeloadandblit.cpp:63: error: ‘struct SCREENS’ has no member named ‘screen’
optimizeloadandblit.cpp:63: error: ‘const struct ScreenAttributes’ has no member named ‘SCREENBPP’
optimizeloadandblit.cpp:65: error: ‘struct SCREENS’ has no member named ‘screen’
optimizeloadandblit.cpp:73: error: ‘struct SCREENS’ has no member named ‘message’
optimizeloadandblit.cpp:74: error: ‘struct SCREENS’ has no member named ‘BG’
optimizeloadandblit.cpp:76: error: ‘struct SCREENS’ has no member named ‘BG’
optimizeloadandblit.cpp:76: error: ‘struct SCREENS’ has no member named ‘screen’
optimizeloadandblit.cpp:77: error: ‘struct SCREENS’ has no member named ‘BG’
optimizeloadandblit.cpp:77: error: ‘struct SCREENS’ has no member named ‘screen’
optimizeloadandblit.cpp:78: error: ‘struct SCREENS’ has no member named ‘BG’
optimizeloadandblit.cpp:78: error: ‘struct SCREENS’ has no member named ‘screen’
optimizeloadandblit.cpp:79: error: ‘struct SCREENS’ has no member named ‘BG’
optimizeloadandblit.cpp:79: error: ‘struct SCREENS’ has no member named ‘screen’
optimizeloadandblit.cpp:81: error: ‘struct SCREENS’ has no member named ‘messasge’
optimizeloadandblit.cpp:81: error: ‘struct SCREENS’ has no member named ‘screen’
optimizeloadandblit.cpp:83: error: ‘screen’ was not declared in this scope
optimizeloadandblit.cpp:89: error: ‘struct SCREENS’ has no member named ‘message’
optimizeloadandblit.cpp:90: error: ‘struct SCREENS’ has no member named ‘BG’