C Interfaces and Implementations: Techniques for Creating Reusable Software

C Interfaces and Implementations: Techniques for Creating Reusable Software

David R. Hanson

Language: English

Pages: 544

ISBN: 0201498413

Format: PDF / Kindle (mobi) / ePub


creating reusable software modules; they are the building blocks of large, reliable applications. Unlike some modern object-oriented languages, C provides little linguistic support or motivation for creating reusable application programming interfaces (APIs). While most C programmers use APIs and the libraries that implement them in almost every application they write, relatively few programmers create and disseminate new, widely applicable APIs. C Interfaces and Implementations shows how to create reusable APIs using interface-based design, a language-independent methodology that separates interfaces from their implementations. This methodology is explained by example. The author describes in detail 24 interfaces and their implementations, providing the reader with a thorough understanding of this design approach. Features of C Interfaces and Implementations: * Concise interface descriptions that comprise a reference manual for programmers interested in using the interfaces. * A guided tour of the code that implements each chapters interface tp help those modifying or extending an interface or designing related interfaces. * In-depth focus on algorithm engineering: how to packag

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

free tuned for a specific application. They first run the application with versions of malloc and free that collect statistics about block sizes, frequency of allocation versus deallocation, and so forth. They then feed these data to a program that generates source code for versions of malloc and free customized for the application. These versions often use quick fit with a small, application-specific set of block sizes. C Interfaces and Implementations: Techniques for Creating Reusable

arena->prev = NULL; arena->limit = arena->avail = NULL; return arena; } Arena_dispose calls Arena_free to deallocate the chunks in the arena; it then frees the arena structure itself and clears the pointer to the arena: ¢functions 93²+≡ void Arena_dispose(T *ap) { assert(ap && *ap); Arena_free(*ap); free(*ap); *ap = NULL; } Arena uses malloc and free instead of, say, Mem_alloc and Mem_free, so that it’s independent of other allocators. Most allocations are trivial: They round the request amount

Implementations: Techniques for Creating Reusable Software. C Interfaces and Implementations: Techniques for Creating Reusabl Prepared for frliu@microsoft.com, Frank Liu Copyright © 1997 by David R. Hanson.. This download file is made available for personal use only and is subject to the Terms of Service. Any other use requires prior written consent from the copyright owner. Unauthorized use, reproduction and/or distribution are strictly prohibited and violate applicable laws. All rights

and Addison Wesley Longman, Inc. was aware of a trademark claim, the designations have been printed in initial caps or all caps. The authors and publishers have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. The publisher offers discounts

1. 2. 4. 5. 6. Introduction Interfaces and Implementations Exceptions and Assertions Memory Management More Memory Management Data Structures 7. 8. 9. 10. 11. 12. 13. Lists Tables Sets Dynamic Arrays Sequences Rings Bit Vectors Strings 3. 14. 15. 16. Atoms Formatting Low-Level Strings High-Level Strings Arithmetic 17. Extended-Precision Arithmetic 18. Arbitrary-Precision Arithmetic 19. Multiple-Precision Arithmetic Threads 20. Threads Most readers will benefit from reading all of

Download sample

Download