Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 06:33, 31 December 2007.

Reducing Code Size

From Forum Nokia Wiki

Following are some of the tips for reducing the code size by eliminating unnecessary things from your code

Contents

Avoid Excessive TRAP Harnesses

Trap harnesses use up space when they are compiled. Code that contains many TRAP macros (e.g., more than five in a class) is using up too much space. It is also probably incorrectly designed, as the TRAP harness is not intended for use extensively in normal code. It is there to allow advanced development of special error handling and recovery routines.


Avoid Debug Code In Release

If there is any code for logging, debugging, or testing, it needs to be excluded in release builds. The compiler directive #ifdef _DEBUG can be used for this purpose.


Avoid Unnecessary Exported Functions

When functions are exported using IMPORT_C and EXPORT_C from a DLL, they use up space for the export table. Only functions that need to be used outside of the DLL should be exported.


Avoid Unnecessary Virtual Functions

Unnecessary virtual functions are bad, for reasons similar to exports, as they create extra vtable functions.


Decomposable Functions

There are many places where a number of functions that perform very similar tasks are present in a class. Often this common code can be abstracted out into a single function, which is parameterized to perform the different tasks required. A common example of this kind of thing is a class that implements both NewL and NewLC. Rather than duplicate the code in both functions, NewL can just call NewLC, performing a CleanupStack::Pop afterwards.


Use Common Controls

If possible, use framework controls that are available in the system (or other shared DLLs) instead of developing new ones.

Related Discussions
Thread Thread Starter Forum Replies Last Post
illegal use of abstract class ('MTimerNotify::TimerExpired(void *, int)') shankha General Symbian C++ 18 2007-10-25 12:50
Image display problem in 6600..... peter_k_john Symbian Media (Graphics & Sounds) 4 2006-08-19 04:52
RE: getRGB(...) zubs20 Mobile Java General 5 2006-03-27 14:50
how to change the size of 'text' on canvas? anyko38155285 Python 14 2008-07-01 12:33
In S60 3rd, CEikGlobalTextEditor::SetExtent can't set the control's size. Shen Tianping Symbian User Interface 5 2007-05-16 08:27
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX