>>>>> "Ben" == Ben Stanley <[EMAIL PROTECTED]> writes:

Ben> Please refresh my memory... on this platform, MAP_FAILED is
Ben> defined to be (-1L)? 

Yes. I meant to make that clear, but forgot.

Ben> With the _POSIX_C_SOURCE define, we should get void* from mmap
Ben> and others... so it is trying to compare void* with long. So the
Ben> only solution left is a reinterpret_cast to get around the bad
Ben> header on that platform.

Indeed.

Ben> I think that the _POSIX_C_SOURCE is the right thing to do - the
Ben> MAP_FAILED thing is a separate problem.

I am not sure about that, but I believe you :) However, until we are
sure we have no complaint from HP-UX, AIX SCO or whatever people, I'd
rather not put it in 1.1.6.

Ben> So what kind of patch are you looking for? Some autoconf magic to
Ben> somehow detect a bad type for MAP_FAILED and to deal with it
Ben> regardless of platform?

Is it possible to do a reintepret_cast which would work always?
Something like
 if (reinterpret_cast<void*>(mm) == reinterpret_cast<void*>(MAP_FAILED))
or is C++ stupid enough to reject this when one type is already void*? 

We could also use good old C casts (since this is a C matter, after
all), if Lars agrees. It seems that now that the problem is somewhat
understood, a brutal cast (with a comment explaining why it is needed)
may be enough and better than convoluted configure things.

JMarc


Ben> Thanks for the reference - I think it shows the _POSIX_C_SOURCE
Ben> macro is the right thing to do to get the correct prototype.

We already define _ALL_C_SOURCE in config.h in some cases. Is it also
useful here?

JMArc

Reply via email to