                          8.     

    char           . 
 addToken()      ,   char 
,  ,       127.  
       ,   
   .
    ++          
      (type-safe linkage).  
       .
           
   .      
 . (       9.)

          ++  
  .     , 
    .      
 ,      
.
      ,      
 (inline)   .     
 , ,       :

   extern int ival = 10;
   double fica_rate;
   extern void dummy () {}

     i     extern,  
    .      dummy(),  
   extern,   :    
 .  fica_rate     :  


389


    extern.     
          
  .

         
 :         .
        ,    const.

   const uchar INLINE = 128;

           .
    . ,   128
 INLINE ,       .   
   ,   (,  
)      ,   . 
        ,   
        .

  , ,   .   
     .     
   extern. :


   // -----   -----
   const int buf_chunk = 1024;
   extern char *const bufp;
   // -----   -----
   char *const bufp = new char[buf_chunk];

    bufp   const,        
 (     new,   
 ).       , 
   ,     .

      ,   ,    ,
  ,        ?

   // :      
   const char* msg = "?? oops: error: ";

     ,  msg  .   , 
.     (  
 .   3):

   const char *const msg = "?? oops: error: ";


                           8.3.  

           .
    : ,   ,

                     8.3.3.   

            
 , , ,      
 .       
 ,      :   
    .
           static ( 
 ). 
          ,    , 
     .
         0. 
       .

                            8.4.2.  auto_ptr 

      ++ auto_ptr   , 
    ,   
 new. ( ,     
 .  auto_ptr    ,   
 .)

   auto_ptr< int > pi ( new int( 1024 ) );

      pi    , 
 1024.  ,    auto_ptr,   
:

   ,    pi,      
 pi.

 auto_ptr    ,    
new:


   void example() 
   {
      //    
      auto_ptr< int > pi;
      {
         //  
         pi = new int( 5 ) ;
      }
   }

         reset(),    
 0,      auto_ptr.  auto_ptr    
  ,       
   auto_ptr. :

   auto_ptr< string > pstr_auto( new string( "Brontosaurus" ) );
   // "Brontosaurus"   
   pstr_auto.reset( new string( "Long-neck" ) );

      ,   assign(),   
 ,       :

  //      
  //   assign()
  pstr_auto->assign( "Long-neck" );

     auto_ptr     
   .      
,      :

      auto_ptr ,   
      new,     .   
          delete  
    ;
     auto_ptr          .

                8.4.3.     


   //     int
   //    1024
   int *pi = new int( 1024 );
   //    1024 
   //   
   int *pia = new int[ 1024 ];
   //     4x1024 
   int (*pia2)[ 1024 ] = new int[ 4 ][ 1024 ];

         ,   
       , ..     
 .  ,      
,   :    .

   char *strl = new char[ str1en( errorTxt ) + 1 ];

   ,   ,   strlen(),   
    C-.     
 ,    ,  
  :   -   .
?  ,   ,  
- ,   ,     .
        ,        
.      string   
++.
     ,      
 ,      
, ,  vector, list  string.   
.

      8.4.4.      

              
.   ,   .  
    new:

   const int *pci = new const int(1024);

        . -,  
 ,      ( , 
    ,    ;  
   ).
   -, ,   new,   . 
  pci    const int.
    ,  ,
  ,      .  
 ,      delete. :

   delete pci;

      delete     const int,  
     ,    pci.
       
, ,    ,    
   new.     
:

   const int *pci = new const int[100]; // 

                   
                           8.4.5.   new 

       new,       
,    ,    .    
 new.

                         8.5.    

                          8.5.5.     

      ,       
     . ,   
   . :

   //  cplusplus_primer::inverse()  use2.C
   // primer.h
   namespace cplusplus_primer {
      // ...
      void inverse( matrix & );
   }
   // usel.C
   #include "primer.h"
   //  cplusplus_primer::inverse()  use1.C
   // use2.C
   #include "primer.h"

    cplusplus::inverse()  primer.h        
   use1.C  use2.C.

                     8.5.6.   

       , ,   
  ,         .
         .
  ,     ,   
    .      
 ,       .     
  ,    ?

    ++      
  ,     .  
    namespace. ,    
  ,        ,  
. :

   //     
   // ----- SortLib.C -----
   namespace {
      void swap( double *dl, double *d2 ) { /* ... */ }
   }

    swap()     SortLib.C.      
    swap(),    . 
  swap()   ,   . 
    :     
       .
        ++    ,  
       static,
  .     , 
 ,   static.       
,   . ,   SortLib.C    ,
  swap():

   // SortLib.C
   // swap()     
   static void swap( double *d1, double *d2 ) { /* ... */ }

       ++      static.
,         
 ,         .

                  8.6.    
                      8.6.1.   
                            8.6.2. Using-
                            8.6.3. Using-
                    8.6.4.    std

