On 12/01/11 16:32, Oleg Goldshmidt wrote:
And today I have an #ifdef in some code I wrote a few weeks ago because STL's compose1 and compose2 are officially parts of STL but not (yet) of the C++ standard, and some interesting platforms have them and some don't, and it may depend on the version of g++, caeteris paribus.


fakeroot-ng prefers to use std::unordered_map, if it's available. If not, __fnu_cxx::hash_map would do. If even that's not available, it would grudgingly use std::map, even though that one has worse performance characteristics.

The test in its configure.ac is rather largish (not huge, mind you - 50 lines including the test for what flags are required to actually make gcc support C++0x), config.h has the following lines (or similar):
/* The type for the map class */
#define MAP_CLASS std::unordered_map

/* The file to include in order to get the map class */
#define MAP_INCLUDE <unordered_map>
The source file contains no #ifdefs at all. See http://fakerootng.svn.sourceforge.net/viewvc/fakerootng/trunk/parent.cpp?revision=313&view=markup#l32 and http://fakerootng.svn.sourceforge.net/viewvc/fakerootng/trunk/parent.cpp?revision=313&view=markup#l54

Still, someone needs to figure out which is the version to use and put it in the right place, and it's not going to be the end user.


I remember guessing that it was probably not considered a big problem on Windows because Windows didn't have shared libraries, so memory would be wasted in any case.

I'm not sure where you got that one. Even assuming you meant "share runtime memory", and not "shared code", Windows does have shared libraries. It is true that you are discouraged from using non-system DLLs from a shared location, unless you jump through the horrible hoops called "manifests", but still, a single application install would be expected to use only one version of a DLL, and its text and read only segments would, generally, be shared between all executables using it.

Shachar

--
Shachar Shemesh
Lingnu Open Source Consulting Ltd.
http://www.lingnu.com


_______________________________________________
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il

Reply via email to