TAILIEUCHUNG - Symbian OS ExplainedEffective C++ Programming for Smartphones phần 10

Nếu bạn ghi đè lên một chức năng ảo mà trước đây được thừa kế, bạn đang làm thay đổi bảng chức năng ảo của lớp. Tuy nhiên, mã khách hàng hiện có được biên dịch chống lại vtable gốc và do đó sẽ tiếp tục truy cập các chức năng cơ bản thừa kế chứ không phải là phiên bản mới, ghi đè. | 324 GOODCODESTYLE void CSwipeCard ChangeSecurityDetailsL Alternative implementation MakePasswordAndPINL has been split into two for simplicity CPIN tempPIN MakePINL Create a temporary PIN CleanupStack PushL tempPIN CPassword tempPassword MakePasswordL CleanupStack PushL tempPassword delete iPIN No need to NULL these nothing can leave delete iPassword before they are reset iPIN tempPIN iPassword tempPassword CleanupStack Pop 2 tempPIN Owned by this CSwipeCard now Finally in this section on memory efficiency it s worth mentioning that you should avoid allocating small objects on the heap. Each allocation is accompanied by a heap cell header which is four bytes in size so it s clear that allocating a single integer on the heap will waste space as well as having an associated cost in terms of speed and heap fragmentation. If you do need a number of small heap-based objects it is best to allocate a single large block of memory and use it to store objects within an array. Degrade Gracefully - Leave if Memory Allocation Is Unsuccessful You should code to anticipate low memory or other exceptional conditions. To save you coding a check that each and every heap allocation you request is successful Chapter 2 describes the overload of operator new which leaves if there is insufficient heap memory for the allocation. Leaves are the preferred method of coping with exceptional conditions such as low memory on Symbian OS. When a memory failure occurs and causes your code to leave you should have a higher level TRAP to catch the failure and handle it gracefully for example by freeing some memory closing the application notifying the user or whatever seems most appropriate . Symbian OS runs on limited-resource mobile phones which will at times run out of memory. So you must prepare your code to cope under these conditions. To help you verify that your code performs safely under low memory conditions Symbian OS provides a variety of test tools and macros that you can use in your own

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.