Changeset 577

Show
Ignore:
Timestamp:
07/01/08 08:07:30 (2 months ago)
Author:
weyrick
Message:

sizes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/rphp/runtime/rphp_pvar.h

    r576 r577  
    4848 
    4949// string types: binary and unicode flavor 
     50 
     51// STL basic string. 
     52// GNU stdc++ provides implicit sharing but this isn't part of the standard 
    5053typedef std::string bstring; 
     54 
     55// UnicodeString uses 2 byte characters. Storage of base class is 32 bytes on 32bit, 40 on 64bit 
     56// implicitly shared 
    5157typedef UnicodeString ustring; 
    5258 
    53 // a variant that represents a php variable 
     59// base variant that represents a php variable 
    5460typedef boost::variant< p3state/*int*/, pint/*long*/, pfloat/*double*/, bstring, ustring, phash, pobject> pvarBase; 
    5561 
    56 // reference to a pvar_base 
     62// reference to a pvarBase, i.e. a container for pvar variables 
     63// shared_ptr maintains a reference count and guarantees proper destruction 
    5764typedef boost::shared_ptr<pvarBase> pvarRef; 
    5865 
    59 // full pvar definition: a variant that can hold a base type or reference 
     66// full pvar definition: a variant that can hold a base type or a reference 
    6067typedef boost::variant< p3state/*int*/, pint/*long*/, pfloat/*double*/, bstring, ustring, phash, pobject, pvarRef> pvar; 
    6168 
  • trunk/rphp/runtime/var-test.cpp

    r576 r577  
    8080    rphp::pvar u,t,r; 
    8181 
     82    // sizes 
     83    std::cout << "p3state: " << sizeof(rphp::p3state) << std::endl; 
     84    std::cout << "pint: " << sizeof(rphp::pint) << std::endl; 
     85    std::cout << "pfloat: " << sizeof(rphp::pfloat) << std::endl; 
     86    std::cout << "bstring: " << sizeof(rphp::bstring) << std::endl; 
     87    std::cout << "ustring: " << sizeof(rphp::ustring) << std::endl; 
     88    std::cout << "phash: " << sizeof(rphp::phash) << std::endl; 
     89    std::cout << "pobj: " << sizeof(rphp::pobject) << std::endl; 
     90    std::cout << "pvarBase: " << sizeof(rphp::pvarBase) << std::endl; 
     91    std::cout << "pvarRef: " << sizeof(rphp::pvarRef) << std::endl; 
     92    std::cout << "pvar: " << sizeof(rphp::pvar) << std::endl; 
     93 
    8294    // binary string 
    8395    u = rphp::bstring("hello world there"); 
     
    91103    std::cout << u << std::endl; 
    92104    result = boost::apply_visitor( my_visitor(), u ); 
    93  
    94105 
    95106    // long 
     
    166177    // references 
    167178 
    168     // create a new reference. can only be comprise of pvarBase items (i.e., can't be a ref to a ref) 
     179    // create a new reference. can only be comprised of pvarBase items (i.e., can't be a ref to a ref) 
    169180    std::cout << "references----" << std::endl; 
    170181    rphp::pvarRef r1(new rphp::pvarBase);