Changes between Version 2 and Version 3 of EFLWebKitCodingStyle


Ignore:
Timestamp:
Jan 4, 2012 12:53:14 AM (10 years ago)
Author:
t.morawski@samsung.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • EFLWebKitCodingStyle

    v2 v3  
    66 * Place '*' operator to data type
    77 * Use '''static_cast<...>''' for type casting
    8 
     8 * Use smart pointers
     9 * Use c++ new/delete operators
    910
    1011= Example =
     
    9495 Ewk_View_Smart_Data* smartData = (Ewk_View_Smart_Data*)data;
    9596}}}
     97
     98== Use smart pointers ==
     99=== Right ===
     100{{{
     101 RefPtr<cairo_region_t> dirtyRegion = adoptRef(cairo_region_create_rectangle(&rect));
     102
     103 or
     104
     105 OwnPtr<WebCore::Page> page = adoptPtr(new WebCore::Page(pageClients));
     106}}}
     107=== Wrong ===
     108{{{
     109 cairo_region_t* dirtyRegion = cairo_region_create_rectangle(&rect);
     110 ...
     111 cairo_region_destroy(dirtyRegion);
     112
     113 or
     114
     115 WebCore::Page* page = new WebCore::Page(pageClients);
     116 ...
     117 delete page;
     118}}}
     119== Use c++ new/delete operators ==
     120=== Right ===
     121Where it is not possible to use smart pointers. Use new/delete operators.
     122{{{
     123 unusedCacheEntry = new Ewk_Tile_Unused_Cache_Entry;
     124 ...
     125 delete unusedCacheEntry;
     126}}}
     127=== Wrong ===
     128{{{
     129 unusedCacheEntry = static_cast<Ewk_Tile_Unused_Cache_Entry*>(malloc(sizeof(Ewk_Tile_Unused_Cache_Entry)));
     130 ...
     131 free(unusedCacheEntry);
     132}}}