+ All Categories
Home > Documents > Symbian C++ Essential Coding Tips (English)

Symbian C++ Essential Coding Tips (English)

Date post: 15-Nov-2014
Category:
Upload: symbian
View: 120 times
Download: 0 times
Share this document with a friend
Description:
This booklet on Symbian C++ coding tips is part of "the Essential Symbian OS series". It was formerly hosted on Symbian Developer Network. The evolving version of the article is here: http://developer.symbian.org/wiki/index.php/Essential_Symbian_C%2B%2B_Coding_Tips
Popular Tags:
36
Transcript
Page 1: Symbian C++ Essential Coding Tips (English)
Page 2: Symbian C++ Essential Coding Tips (English)

Symbian Signed, developed in partnership betweenSymbian, its licensees, network operators anddevelopers, promotes best practice to test and signapplications for Symbian smartphones.

Based on developer feedback, the Symbian Signedprocesses have been improved to make signingfaster, easier and cheaper for developers drivinggrowth in the number of Symbian applications.

• Open Signed - provides a free offline signingprocess using Developer Certificates allowing anapplication to be installed and tested on up to1000 devices controlled by declared IMEIs (uniquephone identification numbers).

• Express Signed - an entirely new process to allowsoftware developers with Publisher IDs toinstantly sign all applications that do not requireaccess to the more sensitive device functions,allowing faster time-to-market. Developers cannow sign applications on Expressed Signed for aslittle as US $20.

• Certified Signed - for those applications thatrequire access to restricted system capabilitiesand/or where independent testing is required.

For more information visit www.symbiansigned.com.

Page 3: Symbian C++ Essential Coding Tips (English)

from

Page 4: Symbian C++ Essential Coding Tips (English)

Coding Tipspart of the Essential Symbian OS series

3rd edition: 12/07

Published by:Symbian Software Limited 2-6 Boundary RowSouthwarkLondon SE1 8HPUKwww.symbian.com

Trademarks, copyright, disclaimer‘Symbian’, ‘Symbian OS’ and other associated Symbian marks are all trademarks of Symbian Software Ltd. Symbian acknowledges the trademarkrights of all third parties referred to in this material. © Copyright SymbianSoftware Ltd 2008. All rights reserved. No part of this material may be reproduced without the express written permission of Symbian Software Ltd.Symbian Software Ltd makes no warranty or guarantee about the suitabilityor accuracy of the information contained in this document. The informationcontained in this document is for general information purposes only andshould not be used or relied upon for any other purpose whatsoever.

AcknowledgementsThanks to all the highly skilled and experienced software engineerswho have shared their tips and best practice over the years. Manyof the tips in this booklet are drawn from their collective wisdom.

Compiled by:Phil SpencerHamish Willee

Managing Editors:Satu McNabbAshlee Godwin

Design Consultant:Annabel Cooke

Updated by:Hamish WilleeMark Shackman

Page 5: Symbian C++ Essential Coding Tips (English)

Introduction

When writing applications for Symbian OS there are manyfactors to consider, from the design right through to thefinal finishing touches of your installation file. Allcontribute to the quality and robustness of yourapplication. This booklet gathers together some usefulhints, tips and links which you, the developer, can use toproduce the most reliable Symbian OS applicationspossible.

Contents

General Tips .............................................................. 2

Design Tips ............................................................... 4

Coding Tips ............................................................... 6

Testing Tips .............................................................. 21

Debugging Tips ........................................................ 22

References ................................................................ 25

Developer Resources ................................................ 26

Page 6: Symbian C++ Essential Coding Tips (English)

General Tips

1. The Symbian Developer Network hosts many valuableresources to help you write applications for SymbianOS. Visit http://developer.symbian.com regularly toget the latest SDKs, technical information, codeexamples and white papers. The Developer Networkwebsite provides access to:

• The Symbian OS FAQ database(http://developer.symbian.com/faqs), an invaluablesource of information for developers, covering themost frequently asked design and codingquestions.

• Technical documentation and white papers,regularly published athttp://developer.symbian.com/main/oslibrary/, and on the Symbian Developer wiki athttp://developer.symbian.com/wiki.

• Symbian Developer Library, the canonical APIreference and guide for Symbian OS.

• Downloads including: example applications; utilitylibraries; ‘optional’ system APIs, which are part ofSymbian OS but may not ship on all phones;ported libraries that allow some APIs on newerSymbian OS versions to run on older OSversions.

2

Page 7: Symbian C++ Essential Coding Tips (English)

• Information about tools for debugging anddevelopment.

• Newsgroup forums(http://developer.symbian.com/faqs) where youcan get advice from Symbian engineers and thewider developer community. Forums exist to coverall aspects of development, from C++ and Java-specific questions, to hardware and to theSymbian Signing process.

2. Sign up to the Symbian Developer Networknewsletter (http://developer.symbian.com/register)as part of your registration to the SymbianDeveloper Network website. This newsletter isdistributed monthly by email and is the best wayto keep up to date with the latest Symbiandeveloper news.

3. Mobile phone manufacturers that use Symbian OSalso run developer programs. You should register attheir sites to get access to the latest phone-specificinformation and tips.

4. Get accredited! The Accredited Symbian Developerqualification (http://developer.symbian.com/asd)shows employers you are a competent Symbian OSengineer, and helps you to objectively assess yourSymbian OS competencies.

3

Page 8: Symbian C++ Essential Coding Tips (English)

5. Symbian Signed promotes best practice in designingapplications to run on Symbian OS phones. SymbianSigned applications follow industry-agreed qualityguidelines and support network operatorrequirements for signed applications. Go to theSymbian Signed website (www.symbiansigned.com) tolearn more about the signing process.

6. There is a vibrant developer community outside ofSymbian and our licensees. Seehttp://developer.symbian.com/main/getstarted/developer_community for links to a number ofprominent third party developer sites.

7. Finally, there are a growing number of Symbian OSpublications available. Symbian Press(http://developer.symbian.com/books) offers booksand booklets on a range of topics, all designed tohelp you write Symbian OS code more easily andreliably. Foreign language translations are nowavailable for many of these!

Design Tips

8. Separate out your ‘engine’ and UI code into differentmodules. Symbian OS itself is designed this way andit aids porting between different UI systems.

4

Page 9: Symbian C++ Essential Coding Tips (English)

One approach is to handle this modularization at thebinary level by placing all non-UI related code into aseparate engine DLL file. Your Application UI can thenlink to this DLL for access to engine functionality. Analternative approach is to make this distinction atsource level so that your application builds as onesingle EXE file, but your ‘engine’ and UI-related codeis separated into different CPP and H files for easiermanagement and debugging.

9. Design with support for localization in mind. Neverhard-code strings or literals that are intended to beviewed by application users into your source files –use the resource file mechanism Symbian OSprovides to store strings.

10. Use only those APIs which are documented andsupported for given SDK and Symbian OS releases.Symbian reserves the right to change or remove APIswhich are not intended to be used by externaldevelopers in future releases. APIs tagged asdeprecated should be avoided if possible; these arestill supported in the current releases but have beenmarked as ‘ready for removal’ in a subsequentrelease.

11. Do not assume all ‘system’ files, for example, sound

5

Page 10: Symbian C++ Essential Coding Tips (English)

files, images, etc. will be present on all phones. Atthe very least, you should always consider properhandling of the error condition should the file notbe present on future handsets.

12. Do not assume that all Symbian OS DLLs will bepresent on all phones. Symbian OS licensees have agreat deal of flexibility to customize their handsets;while some components are mandatory, others areoptional (http://developer.symbian.com/main/downloads/papers/SymbOS_cat/SymbianOS_cat.html).One method of working around optional DLLs is tocreate and (dynamically) load an ECOM plugin whichin turn ‘statically’ loads the problem DLL. If theoptional DLL is not present, the calling code canhandle the KErrNotFound leave onCreateImplementationL().

Coding Tips

The following are a collection of general tips which youshould bear in mind when writing your code.

13. Ensure your application responds to systemshutdown events. It is vital that you respond toEEikCmdExit (and any platform-specific events, forexample, EAknSoftkeyBack on S60) in yourAppUi::HandleCommandL() method.

6

Page 11: Symbian C++ Essential Coding Tips (English)

14. Respond to incoming system events. Remember thatyour application is operating on a multitaskingphone system. You need to pay careful attention tofocus gained/lost events, etc. to ensure that yourespond correctly when the user receives a highpriority notification. For example, ensure that yousave your state and data when there is an incomingphone call which will cause your application to losefocus (i.e., you need to act appropriately onstandard ‘to background’ events – see the SDK formore details). Generally, the framework shouldhandle this for you and no special action is requiredon your part, but be sure to check that you’re notdoing anything which prevents the framework fromoperating as intended.

15. Memory handling on Symbian OS is a major topicfor consideration. Note that behavior on the phonecan sometimes differ to that on the emulator. It isvital that you test your application on the realphone before submitting it to Symbian Signed fortesting.

16. The stack is small! Where possible, allocate objectson the heap rather than on the stack. UnexplainedKERN-EXEC 3 crashes are often symptomatic of stackcorruption/overflow.

7

Page 12: Symbian C++ Essential Coding Tips (English)

17. An application panic indicates a real bug in yourcode. Panic codes are documented in the SymbianDeveloper Library alongside each method, and in theSystem Panic Reference (Symbian OS reference >System panic reference). Here are some commonerrors:• Forgetting to add non-member, heap-allocated

variables to the cleanup stack.• Putting member variables on the cleanup stack -

never do this; just delete them in your destructoras normal.

• The 'double delete'. For example, failure tocorrectly Pop() an already destroyed item fromthe cleanup stack, causing the stack to try anddelete it again at a later time, or deleting amember variable when it has been used, butforgetting to set it to NULL so that it is deletedagain in the destructor.

• Accessing functions in variables which may notexist in your destructor. For example, the codebelow will panic if iSomeServer is NULL - whichmight happen if your object is destroyed beforeyou allocate the memory, or if you have deletedthe memory somewhere else in the application:

CMyClass::~CMyClass()

{

iSomeServer->Close();

delete iSomeServer;

}

8

Page 13: Symbian C++ Essential Coding Tips (English)

You should instead code this as:

CMyClass::~CMyClass()

{

if (iSomeServer)

{

iSomeServer->Close();

delete iSomeServer;

}

}

• Calling a function on a NULL pointer• Calling a function on a variable that has since

gone out of scope, for example, by passing astack-based variable into a callback to anasynchronous function.

18. Failing gracefully when system resources areunavailable is important. The most constrainedresource is usually system RAM, so you need to becareful to handle low memory correctly. Two-phaseconstruction and the use of the cleanup stack, asdescribed below, are essential parts of suchdefensive programming.

19. Always use CleanupClosePushL() with ‘R’ classeswhich have a Close() method. This will ensure theyare properly cleaned up if a leave occurs. For example:

9

Page 14: Symbian C++ Essential Coding Tips (English)

RFile file;

User::LeaveIfError(file.Open(…));

CleanupClosePushL(file);

CleanupStack::PopAndDestroy(&file);

You can also use CleanupReleasePushL() for “M”and “R” classes which use Release() instead ofClose(). CleanupDeletePushL() calls delete onthe pushed object, and CleanupArrayDeletePushL()

calls delete on a pushed array.

20. In addition, remember that the cleanup stack is anextensible mechanism that can be used for cleaning upanything when there is a leave. If you have a morecomplex situation to deal with, don’t just ignore propercleanup. See the Symbian OS Library documentationon TCleanupItem for more information.

21. If you have cause to use a TRAP of your own, do notignore errors that you do not handle. A commoncoding mistake is:

TRAPD(err, DoSomethingL());

if (err == KErrNone ||

err == KErrNotFound)

{

// Do something else

}

10

Page 15: Symbian C++ Essential Coding Tips (English)

This means all other error codes are ignored. If youmust have a pattern like the one above, leave forother errors:

TRAPD(err, DoSomethingL());

if (err == KErrNone ||

err == KErrNotFound)

{

// Do something else

}

else

User::Leave(err);

22. Do not wait to PushL() things on to the cleanupstack. Any newly allocated object (except membervariables) should be added to the cleanupimmediately. For example, the following is wrong:

void DoExampleL()

{

CSomeObject* myObject1=new (ELeave)

CSomeObject;

CSomeObject* myObject2=new (ELeave)

CSomeObject;

// Do something here with the variables

CleanupStack::PushL(myObject1);

11

Page 16: Symbian C++ Essential Coding Tips (English)

CleanupStack::PushL(myObject2);

// Do something more with the variables

CleanupStack::PopAndDestroy(2);

// myObject2, myObject1

}

because the allocation of myObject2 could fail,leaving myObject1 ‘dangling’ with no method ofcleanup. The above should be:

void DoExampleL()

{

CSomeObject* myObject1=new (ELeave)

CSomeObject;

CleanupStack::PushL(myObject1);

CSomeObject* myObject2=new (ELeave)

CSomeObject;

CleanupStack::PushL(myObject2);

// Do something here with the variables

CleanupStack::PopAndDestroy(2);

// myObject2, myObject1

}

23. Note that functions with a trailing ‘C’ on their name(for example, a NewLC() method) automatically put

12

Page 17: Symbian C++ Essential Coding Tips (English)

the object on the CleanupStack. You should notpush these objects onto the stack yourself or theywill be present twice. The trailing ‘C’ functions areuseful when you are allocating non-membervariables.

24. Two-phase construction is a key part of Symbian OSmemory management. The basic rule is that aSymbian OS constructor or destructor must neverleave. If a C++ constructor leaves, there is no wayto cleanup the partially constructed object becausethere is no pointer to it. For this reason, SymbianOS constructors simply instantiate the object, whichthen provides a ConstructL() method wheremember data can be instantiated. If ConstructL()leaves, the standard destructor will be called todestroy any objects which have been successfullyallocated up to that point. It is essential that youmirror this design pattern to avoid memory leaks inyour code. For each line of code you write, a goodquestion to ask yourself is, ‘can this line leave?’ Ifthe answer is ‘Yes’, then think, ‘Will all resources befreed?’

25. Use the _LIT() macro instead of _L(). The _L()has been deprecated since Symbian OS v5. Theproblem with _L() is that it calls the TPtrC(constTText*) constructor, which has to call a strlen()

13

Page 18: Symbian C++ Essential Coding Tips (English)

function to work out the length of the string.Whilst this doesn't cost extra RAM, it does costCPU cycles at runtime. By contrast, the _LIT()macro directly constructs a structure which is fullyinitialized at compile time, so it saves the CPUoverhead of constructing the TPtrC. You shouldalso consider whether you should be using a hardcoded literal at all; hard coded literal descriptorsmay need to be re-coded if you later localize yourapplication.

26. Avoid declaring literals in your header files becauseall CPP files that include the header will generate anew copy, leading to code bloat. If there is a needfor your _LIT to be visible to a number of files,put it in a CPP file and have a method that returnsa reference to it.

27. When using descriptors as function parameters:• Use the base class by default as this allows

clients of the function to use the concretedescriptor type that suits them best. For non-modifiable descriptors use const TDesC& andfor modifiable descriptors use TDes&.

• Always pass TDesC or TDes parameters byreference rather than by value. The rules ofC++ mean that passing by value will create acopy of the TDesC/TDes (which has no data)

14

Page 19: Symbian C++ Essential Coding Tips (English)

rather than the descriptor you intended.• Always specify const for TDesC parameters.

This avoids compiler errors when you passliterals into the function.

28. Do not instantiate TDesC or TDes as these don’tprovide storage space for data or for a pointer todata; instead you should declare the concreteclasses derived from them.

29. Do not try to set the size of a stack descriptor as arun time-calculated value. Stack classes aretemplated and hence their size must be determinedat compilation time – the following will result in acompilation error:TInt length = someValue;

TBuf<length> myDescriptor;

30. Do not place large descriptors (or other objects) onthe stack as it is a very limited resource. As ageneral rule, if a descriptor is greater than 256bytes, consider allocating it on the heap. There aresome stack descriptor typedefs which allocate morethan this, and which therefore should be used withcare: for example, TEntry, TFileName, TFullName,TName.

31. Do not allocate larger-than-necessary buffers on theoff-chance that a large buffer will be required; this

15

Page 20: Symbian C++ Essential Coding Tips (English)

is wasteful of memory! Instead allocate buffers thatare closer to the normal size, and expand asnecessary.

32. Be wary of the TPtr assignment operator(TPtr::operator=()). TPtrs come in two types, onewhich has a pointer to data (type 2), and one whichcontains a pointer to another descriptor (type 4).Attempting to assign the value of a type 2 with a type4 TPtr will result in a panic (even though the reverseworks). It is safer to use the TPtr::Set() method, asthis changes the type of the descriptor appropriately.

33. Be wary that type 4 TPtr copy constructors do notbehave in the same way as their assignmentoperators. The copy constructor creates a newdescriptor that points to the same descriptor as theoriginal, while the assignment operator copies thedata from the first descriptor to where the seconddescriptor is pointing. For a type 2 TPtr , whichhas a pointer to data rather than anotherdescriptor, the copy constructor and assignmentoperator behave the same so that assignmentcauses the second descriptor to point to the samedata as the original.

34.Use an RBuf in preference to an HBufC for stringsthat you intend to manipulate/modify.

16

Page 21: Symbian C++ Essential Coding Tips (English)

35.You don't need to use HBufC::Des() to get into aHBufC. All you have to do is dereference the HBufCwith the * operator – this is particularly relevant,for example, when passing an HBufC as anargument to a method which takes a TDesC&parameter (as recommended above). Note that, asyou’re modifying the string, you should considerusing an RBuf instead of an HBufC.

36.Always set member HBufC variables to NULL afterdeleting them if you intend to re-allocate to thesame variable. Since HBufC allocation (or re-allocation) can potentially leave, you could findyourself in a situation where your destructorattempts to delete an HBufC which no longerexists. This is true of any heap-allocated variable,but doing this with HBufC tends to be a commonusage pattern.

37.Use Alloc() when creating an HBufC from adescriptor. A common mistake is to do:HBufC* myData =

HBufC::NewL(someBuffer.Length);

TPtr ptr= someBuffer.Des();

ptr.Copy(someBuffer);

when you can just do:HBufC myData = someBuffer.AllocLC();

17

Page 22: Symbian C++ Essential Coding Tips (English)

38.Be wary of HBufC::ReAllocL() andHBufC::ReAlloc() as these may return a differentaddress from the original HBufC*. It is a commonmistake to continue to use (invalid) TPtr pointersto the old buffer after re-allocation.

39.When using a method which takes a formattingspecifier, use %s for formatting C style strings and%S for formatting descriptors. Formatting with thewrong type can raise an exception.

40. Initialize TPtr class data members in theconstructor initialization list. TPtr does not have adefault constructor so doing otherwise will result ina compilation error.

41. Perform bounds checking when appending orinserting data to your descriptor. Descriptors dothis check internally, and will panic if your changescause a descriptor to exceed its maximum length.

42.When passing or returning an object to a function,ensure that if you take ownership of the object youdelete it! Symbian uses the convention thatpointers in a method indicate transfer ofownership, while references indicate that callerretains ownership of the passed object.

18

Page 23: Symbian C++ Essential Coding Tips (English)

43.Active objects and the active scheduler are keySymbian OS frameworks. You should carefully studythe SDK documentation and Symbian DeveloperNetwork white papers to get a good understandingof the way these work. Here are a few useful tips:• The active scheduler places a TRAP around

RunL() and, in the event of a leave, callsCActive::RunError(). You can choose toTRAP in the RunL() and continue operation,but it is usually easier and ‘cleaner’ to simplyhandle the error cases in your RunError().

• To this end, you should implement your ownRunError() function to handle leaves fromRunL().

• Keep RunL() operations short and quick. Along-running operation will block other activeobjects from running.

• Always implement a DoCancel() function andalways call Cancel() in the active objectdestructor. There are cases where a service APIcannot be cancelled, so your DoCancel() willbe empty and calling Cancel() in the activeobject destructor will do nothing – but this willdo no harm, and it’s a good habit to develop.

• Ensure that DoCancel() doesn’t contain anycleanup code that must always be run –calling Cancel() will only result in a call toDoCancel() if the request is active.

19

Page 24: Symbian C++ Essential Coding Tips (English)

44.Similarly, you should make use of the active objectframework wherever possible. Tight polling in aloop is highly inappropriate on a battery-powereddevice and can lead to significant power drain. Payparticular attention to this when writing games –see the ‘Roids’ technical paper on the SymbianDeveloper Network website(http://developer.symbian.com/roidsgame).

45.ViewSrv 11 panics are a hazard when writing busyapplications, for instance, games. They occur whenthe ViewSrv active object in your, or any other,application does not respond to the view server intime. Typically 10-20 seconds is the maximumallowed response time. See FAQ-0900 for a moredetailed explanation and FAQ-0920 for practical tipsto avoid this problem. Both are available from theSymbian OS FAQ database athttp://developer.symbian.com/faqs.

46.When making use of the standard application INIfile functionality (i.e., by using theApplication()->OpenIniFileLC(); API in yourApplication UI class), be sure to write into streamswith version number information. This allows youto create new streams for future versions of yourapplication and means if an end user installs a newversion of your product in the future, an ‘old’ INI

20

Page 25: Symbian C++ Essential Coding Tips (English)

file will not cause the new version to panic if itcannot find the right settings or stream.

47.Take care when implementing framework classes inyour application. You should always derive from theplatform-specific framework classes provided. Forexample, on UIQ, derive your Application UI classfrom CQikAppUi rather than from CEikAppUi. All ofthe UI-specific application base classes(CQikAppUi, CQikApplication, andCQikDocument) add functionality that the platformUI framework relies on to make applicationsperform correctly.

Testing Tips

48. The most important testing tip is to exit yourapplication under the emulator, not just to close theentire emulator. In debug mode, there is memoryand handle checking code surrounding theapplication framework shutdown functions. If youexit your application, this code will be invoked andyou will be able to see if you have leaked memoryor left a handle (e.g., an R object) open. For UIQapplications it is customary to provide an Exit menuitem in debug mode only for this purpose.

49. Another vital tip is to ensure the correct platform

21

Page 26: Symbian C++ Essential Coding Tips (English)

dependency information is included in your PKG fileprior to deployment. More details of the dependencystring you require should be in your platform-specificSDK. FAQ-0853 on the Symbian OS FAQ database athttp://developer.symbian.com/faqs also offers usefulinformation.

50. When writing your PKG file, also ensure you use the!:\ syntax where appropriate. In general, yourapplication should install and run from any drive onthe end user’s phone. Very few things (e.g., INIfiles) should be put on C:\ only.

Debugging Tips

51. Always debug on the emulator first; most problemsthat occur on both the emulator and hardware aremuch easier to debug on the emulator.

52. When writing and debugging a new CCoeControl-derived class, put iEikonEnv->WsSession().SetAutoFlush(ETrue) in the ConstructL()function of your Application UI. This means thatgraphics context (gc) draw commands will show upin the emulator immediately, rather than when thewindow server client buffer is next flushed. Edit yourWSINI.INI file(\epoc32\release\winscw\udeb\system\data\) andensure that the keyword FLICKERFREEREDRAW is notpresent. This means you can step through the draw

22

Page 27: Symbian C++ Essential Coding Tips (English)

code and see the effect each line is having.However, you must ensure this line does not make itinto released software as it has efficiencyimplications.

53. You should regularly run the LeaveScan tool overyour source files. This will check all functions forcode which can leave and report an error if they donot have a trailing L on their name, highlighting apotential bug or oversight in your source. This isuseful for checking which code should be allowed topotentially leave and making sure you handle theeventuality properly. See FAQ-0291 on the SymbianOS FAQ database athttp://developer.symbian.com/faqs to download thetool and read further information.

54. If your application panics on shutdown due to amemory leak, casting the leaked address to CBase*on your IDE will often give you the type of the leakedobject. The Hooklogger tool (which can bedownloaded from the Symbian Developer Network) isoften even more useful for debugging memory leaks.

55. An important recent addition to the functionality availablefor Symbian OS developers is on-target debugging. Whilstthis is not currently available for all SDK and toolvariants, most of the latest SDK and IDE releases dosupport this. Where available, this can be used to trackdown any phone-specific defects. See your SDK and/or

23

Page 28: Symbian C++ Essential Coding Tips (English)

IDE documentation for more information.

56. Make sure ‘Just in Time’ debugging is enabled by:• Adding the following macro(s) to

\epoc32\data\epoc.ini: ‘JustInTime debug’, or ‘JustInTime query’.

• Ensuring that ‘JustInTime 0’ or ‘JustInTime none’are removed from your epoc.ini file.

• Calling User::SetJustIntime() within your code• If you’re using CodeWarrior, setting the following

registry value:

[HKEY_LOCAL_MACHINE\SOFTWARE/Microsoft\Windows NT\CurrentVersion\AeDebug]

“UserDebuggerHot Key” = dword : 00000000“Debugger” = \”C;\\apps//Metrowerks//bin\\IDE.exe\” - p %ld - e % l d”

“Auto” = “0”

57. Review debug messages in %Temp%epocwind.out

58. Use the available developer tools includingLeaveScan, HookLogger, Panix and D_EXC to debugmemory leaks and other errors. These and manyother useful tools can be downloaded from theSymbian Developer Network(http://developer.symbian.com/main/tools).

59. FAQ-1344 shows how you can enable diagnostics todebug platform security (KErrPermissionDenied)violations - making it easy to identify missingcapabilities.

24

Page 29: Symbian C++ Essential Coding Tips (English)

References

Symbian Developer Network newsletterhttp://developer.symbian.com/register

Symbian OS FAQ databasehttp://developer.symbian.com/faqs

Symbian Presshttp://developer.symbian.com/books

"Roids" Games Writing paperhttp://developer.symbian.com/roidsgame

Active Objects paperhttp://developer.symbian.com/main/downloads/papers/CActiveAndFriends/CActiveAndFriends.pdf

25

Page 30: Symbian C++ Essential Coding Tips (English)

Developer Resources

Symbian Developer Networkhttp://developer.symbian.com

Symbian Developer Network newsletterhttp://developer.symbian.com/register

Symbian OS Tools Providershttp://developer.symbian.com/main/tools

Sony Ericsson Developer Worldhttp://developer.sonyericsson.com

Forum Nokiahttp://forum.nokia.com

Sun Microsystems Developer Serviceshttp://developer.java.sun.com

UIQ Developer Communityhttp://developer.uiq.com

26

Page 31: Symbian C++ Essential Coding Tips (English)

New from

This second edition of DevelopingSoftware for Symbian OS helps softwaredevelopers new to Symbian OS tocreate smartphone applications. Theoriginal book has been updated forSymbian OS v9 and now includes a newchapter on application signing andplatform security, and updatesthroughout for Symbian OS v9 andchanges to the developmentenvironment.

Mobile Python is a practical hands-onbook that introduces the popularopen source programming languagePython to the mobile space. Itteaches how to program your ownpowerful – and fun – applicationseasily on Nokia smartphones basedon Symbian OS and the S60 platform.

Developing Software for Symbian OS, Second Edition

Mobile Python

Symbian Press: developer.symbian.com/press

Page 32: Symbian C++ Essential Coding Tips (English)

New from

This book will help you to become aneffective Symbian OS developer, andwill give you a deep understanding ofthe fundamental principles uponwhich Symbian OS is based.

Targeting Symbian OS v9.1 and v9.2,Symbian OS CommunicationsProgramming - Second Edition willintroduce you to the majorcommunications functionality inSymbian OS and demonstrates howto perform common tasks in eacharea.

Symbian OS C++ for Mobile Phones, Volume 3

Symbian OS CommunicationsProgramming, Second Edition

Symbian Press: developer.symbian.com/press

Page 33: Symbian C++ Essential Coding Tips (English)

Also from

Fully up to date for Symbian OS v9and S60 3rd Edition, S60Programming is an essentialfoundation to developing software forSymbian OS.This practical book is based on theauthors’ experiences in developingand teaching an academic course onSymbian software development.

This book conducts a rapid tour ofthe architecture of Symbian OS andprovides an introduction to the keyideas of object orientation (OO) insoftware, with a detailed explorationof the architecture of Symbian OS.

S60 Programming

The Symbian OS Architecture Sourcebook

Symbian Press: developer.symbian.com/press

Page 34: Symbian C++ Essential Coding Tips (English)

Also from

For all Symbian C++ developers:

Symbian OS C++ for Mobile Phones – Volume 1by Richard Harrison

Symbian OS C++ for Mobile Phones – Volume 2by Richard Harrison

Symbian OS Explainedby Jo Stichbury

Symbian OS Internalsby Jane Sales

Symbian OS Platform Securityby Craig Heath

Smartphone Operating System Concepts with Symbian OSby Mike Jipping

Accredited Symbian Developer Primerby Jo Stichbury & Mark Jacobs

Page 35: Symbian C++ Essential Coding Tips (English)

Published Booklets

Coding Tips

Performance Tips

Getting Started

Java ME on Symbian OS

P.I.P.S

Carbide.c ++

Data Sharing Tips

Essential S60 - Developers' Guide

Essential UIQ - Getting Started

Ready for ROM

Translated booklets available in:Chinese

Japanese

Korean

Spanish

Also from

Page 36: Symbian C++ Essential Coding Tips (English)

Recommended