Eliminating private members from header files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Medvedev

    Eliminating private members from header files

    When i make a dynamic link library is it allowed to eliminate the
    private data members of the classes from the header file which i offer
    to the client ?!!
  • James Kanze

    #2
    Re: Eliminating private members from header files

    On Jul 14, 2:21 am, Medvedev <3D.v.Wo...@gma il.comwrote:
    When i make a dynamic link library is it allowed to eliminate the
    private data members of the classes from the header file which i offer
    to the client ?!!
    No. When the client links includes your object code in his
    program, be it by dynamic linking or static, the class
    definition his code sees must be identical with that you used to
    compile your code. The only thing you can possibly remove from
    it is comments. (The identity is required at the token level.)
    In practice, you can usually get away with a few things---private
    static data members, for example---but as far as the language is
    concerned, as soon as the token sequence is not identical in all
    translation units, you have undefined behavior.

    --
    James Kanze (GABI Software) email:james.kan ze@gmail.com
    Conseils en informatique orientée objet/
    Beratung in objektorientier ter Datenverarbeitu ng
    9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

    Comment

    • Medvedev

      #3
      Re: Eliminating private members from header files

      Stefan Ram wrote:
      Medvedev <3D.v.World@gma il.comwrites:
      When i make a dynamic link library is it allowed to eliminate the
      private data members of the classes from the header file which i offer
      to the client ?!!
      >
      See also
      >


      http://www.gotw.ca/gotw/024.htm
      very helpful links , thanks

      Comment

      Working...