Hallo, On Sat, 17 May 2003, Bernhard Walle wrote: [..]
Nicht jede Instanz, sondern jeder Listentyp, also 17 kB fuer list<int>, weitere 17 kB fuer list<char> etc. Nur dass durch die Inkludierung einer Header-Datei schon Speicher gebraucht wird kann ich nicht glauben.
Was spricht gegen's Ausprobieren? (Code ganz unten) $ for j in `seq 0 3`; do \ g++ -Os -Wall -W -ansi -pedantic -DUSE_LIST=$j -o listtest listtest.cc; \ strip listtest; ls -l listtest; ./listtest; \ done -rwxr-xr-x 1 dh dh 3648 May 17 16:27 listtest Hallo Welt! -rwxr-xr-x 1 dh dh 7460 May 17 16:27 listtest Hallo Welt! charlist: 1 2 3 -rwxr-xr-x 1 dh dh 8932 May 17 16:27 listtest Hallo Welt! charlist: 2 4 6 shortlist: 4 12 8 -rwxr-xr-x 1 dh dh 10404 May 17 16:27 listtest Hallo Welt! charlist: 3 6 9 shortlist: 6 18 12 intlist: 12 36 24 Das mit 17kB ist also Unfug -- zumindest wenn man g++ und die SGI STL verwendet, bei M$ Visual C++ mag das anders aussehen ;-P Achso: -Os vs. -O2 (plus -march= u.a.) macht keinen signifikanten Unterschied: 3648, 7492, 8968, 10536... -dnh ==== listtest.cc ==== #include <iostream> #if USE_LIST > 0 #include <list> #endif int main(void) { std::cout << "Hallo Welt!" << std::endl; #if USE_LIST > 0 int s; std::list<char> charlist; s = sizeof(char); charlist.push_back(USE_LIST*s*1); charlist.push_back(USE_LIST*s*2); charlist.push_back(USE_LIST*s*3); std::cout << "charlist: "; std::copy(charlist.begin(), charlist.end(), std::ostream_iterator<int>(std::cout, " ")); std::cout << std::endl; #endif #if USE_LIST > 1 std::list<short> shortlist; s = sizeof(short); shortlist.push_back(USE_LIST*s*1); shortlist.push_back(USE_LIST*s*3); shortlist.push_back(USE_LIST*s*2); std::cout << "shortlist: "; std::copy(shortlist.begin(), shortlist.end(), std::ostream_iterator<int>(std::cout, " ")); std::cout << std::endl; #endif #if USE_LIST > 2 std::list<int> intlist; s = sizeof(int); intlist.push_back(USE_LIST*s*1); intlist.push_back(USE_LIST*s*3); intlist.push_back(USE_LIST*s*2); std::cout << "intlist: "; std::copy(intlist.begin(), intlist.end(), std::ostream_iterator<int>(std::cout, " ")); std::cout << std::endl; #endif return 0; } ==== -- They tell me that you're going to try posting to Alt.Sysadmin.Recovery. It's a Magnificent Idea; A Daring and Splendid Idea! It will be FUN! Assuming you're not vaporized, dissected, or otherwise killed in an assortment of supremely horrible and painful ways! Exciting, Isn't It?! -- grabbed off of Earl Grey, just there