Tuesday 15 June 2010

c - Type specifications in platform ABIs -


Which of these items can be safely deemed to define in any practically usable platform ABI is?

  • >, size_t , ptrdiff_t
  • unsigned char and signed letter < Li> intptr_t and uintptr_t
  • float , double and long double < / Code>
  • short and longer
  • int
  • Pointer for an object type for which Platform ABI specifies these properties
  • To function Pointer
  • Type is only included for which Platform ABI specifies these properties
  • to represent a null object pointer to the object presentation

  • object instance, if I have compiled a library (by an unknown, but ABI-Knfrming compiler) which This function publishes:

      Zero * foo (Zero * Left) , Akar_ti hawk, void * (* qux) ());   

    Can I anticipate being able to call it safely in my program? Or, if I am writing a library, there is such a set, such as if I limit the public interface of the library to this set, then it is usable on all platforms. Will it be guaranteed where it is made?

    The C standard has an entire section in which the addendum is summarized: <

    Of these, signed four and are unsigned char char

  • Maltibait and text encoding for wide strings

  • signed integer representing

  • a pointer to a Unlike the results of the change in the integer and vice versa (6k3k2k3) Note that this means any pointer, object not only pointers.


    Update: about the ABI to solve your question: the ABI (Application Binary Interface) is a standardized concept It is not said that the implementation should also be referred to the ABI. The content of ABI behavior partly implementation of the language-defined (although it is not all, as has been signed-defined-unsigned conversion implementation, but is not part of ABI), and implementation-defined aspects Most language is determined by hardware (for example signed integer representation, floating point presentation, pointers boss ).

    However, the more important aspects of ABI are how function calls work, i.e. where logic is stored, which is responsible for cleaning the memory, etc. It is important for these assemblers to agree on those Conventions that their code is compatible with BinIOOver.

    In practice, ABI generally determines the implementation results after the compiler is completed, depending on its implementation - an ABI. It can document this ABI document, and other compilers, and future versions of the same compiler, may like to stick to those conventions. C implementation on X86, it worked well and only a few, usually well documented, free parameter, which is required to transmit the code to interoperate but for other languages, especially C ++, you have a completely different picture: Nothing close to standard ABI for C ++. Microsoft compiler uses C + + AB breaks the GCC for a now defunct architecture that works hard to maintain ABI compatibility across multiple versions and published Itanium AB (ironically) with every release. Other compilers can do their own, completely different things (and then you have definite problems with the C ++ standard library implementation , like your string There are one, two or three points in which, and in what order?)

    In summary: A compiler is associated with many aspects of ABI, especially C, determined by hardware architecture. For the same hardware different compilers should prepare compatible binary code, as long as the function call conventions are properly reported. However, all bets are closed for high-level languages, and whether two different compilers can create interoperable codes, it should be decided on a case-by-case basis.

  • No comments:

    Post a Comment