[cxx-abi-dev] Question about guard variable types

Jim Dehnert dehnert at transmeta.com
Sat Dec 7 03:02:37 UTC 2002


Mark Mitchell wrote:
>>> (Note that even though the __cxa_guard functions are extern "C" you
>>> can still observe their types; take their addresses.)
>>
>> But that is not relevant for the ABI, is it?
> 
> Well, the ABI has this little API part. :-)  The <cxxabi.h> header
> is documented and required.  You can use it in low-level
> applications -- one good example would be if you're writing a C++
> interpreter that wants to interact correctly with compiled C++
> object files.  (This was CenterLine's ObjectCenter product.)
> 
> All of the other functions have portable types; why not this one?

That is the right answer, of course.  But it needs to be at least
64 bits.  Your original message seemed to be suggesting that less
might be OK, and the consensus in the original discussion was that
a simple, efficient mutex implementation probably needs 64.

> There are two cases:
> 
> 1) Those things are always the same, in which case we may as well say
>   "long long" in the ABI so that things match up and we have a
>   well-defined type for the function, and so that a new GCC port
>   doesn't accidentally stray from the ABI, or;
> 
> 2) Those things are not always the same, in which case something needs
>   to change, and G++'s widespread deployment would argue for the ABI
>   changing.

As Jason points out, what we really should worry about is a future
situation where something larger is required.  It seems to me that
defining it as an opaque type with size at least 64 bits in the ABI
is the right thing to do.  If g++ implements that with long long, it
should be OK if the standard requires 64-bit long long.

Jim






More information about the cxx-abi-dev mailing list