C++ Workshop - Preprocessor Directives & Bit Manipulation (Ch. 21)

Started by
-1 comments, last by JWalsh 16 years, 11 months ago

Welcome to the GDNet C++ Workshop – Ch. 21

For a complete introduction to this workshop, please look here. Workshop Overview This workshop is designed to aid people in their journey to learn beginning C++. This workshop is targeted at highly motivated individuals who are interested in learning C++ or who have attempted to learn C++ in the past, but found that without sufficient support and mentoring they were unable to connect all the pieces of this highly complex but powerful programming language. This is a 'guided' self-teaching C++ workshop. Each student is responsible for taking the time to read the material and learn the information. The community and tutors that arise out of this workshop are here for making the learning process run more smoothly, but are not obligated to baby-sit a person's progress. Because everyone will be working from the same textbook (Teach Yourself C++ in 21 days 5th Ed.), students may find it easier to get answers to the specific questions they might have. There is no minimum age requirement, and there is no previous programming experience required. Additionally, this workshop does not attempt to defend C++ as a language, nor does it attempt to demonstrate that C++ is either more or less useful then other programming languages for any particular purpose. People who intend to start a discussion about the differences between C++ and ANY other languages (except as are relevant to a particular discussion), are encouraged to do so elsewhere. This workshop is for educational, not philosophical discussions. Quizzes & Exercises Each week will have quizzes and exercises posted in the weekly threads. Please try and answer them by yourself. As well, please DO NOT post the answers to Quizzes and Exercises within this thread. Once it becomes acceptable to post the answers to quizzes and exercises, an additional thread will be created each week specifically for the purpose of posting quiz answers. If you try with reasonable effort but are unable to answer the questions or complete the exercises, feel free to post a clarification question here on the thread. Tutors, myself, or others will do the best we can to point you in the right direction for finding the answer.

Chapter 21 – What's Next

Introduction At long last...the workshop is complete. This final chapter is healthy serving of many topics which describe some of the more esoteric areas of C++. In specific this final chapter will cover the illusive preprocessor, and how its power can be harnessed to create defined constants, conditional compiles, inclusion guards, and macros. A few of the standard preprocessor keywords are also discussed for debugging purposes. These include the __LINE__, __FILE__, __DATE__, and __TIME__ macros, which are essential in any C++ programmers debugging toolbox. Many assert macros have been written using these little gems. The second part of this final chapter describes bit manipulation. This stuff is really pretty cool. Although we use bit manipulation less on modern computers, these simple tools were used quite frequently on earlier processors, when data types were no larger than a byte, and efficient programming required squeezing as much as possible out of each bit of data. Although less used, these techniques are still frequently used in networking, compression, and some graphics technologies. And finally, the workshop ends with a discussion of programming style. This tends to land squarely in the middle of a programming religious debate, but my parting words are to either use whatever programming style is required by your project leads or place of employment, or, given the choice to develop your own programming style...just be consistent with whatever you choose. Although the workshop ended later than anticipated, it has indeed ended. My next plan is to rename the threads of the C++ workshop into something more relevant for a C++ forum, and continue to patrol the forum to answer questions for those still interested in learning C++. To those who encouraged me to finish, I thank thee. For those who religiously read the threads and posted feedback, I thank thee. And to all those who learned something from this workshop, I thank thee as well. Feel free to PM me with any C++ or miscellaneous GDNet questions you may have. Outline of the Reading - Chapter 21
  1. The Preporcessor and The Compiler
  2. The #define Preprocessor Directive
  3. Inclusion and Inclusion Guards
  4. Macro Functions
  5. String Manipulation
  6. Predefined Macros
  7. The assert() Macro
  8. Inline Functions
  9. Bit Twiddling
  10. Programming style
  11. Next Steps in Your C++ Development
Additional Resources None...

Good Luck!

[Edited by - jwalsh on May 30, 2007 5:39:18 PM]
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints

This topic is closed to new replies.

Advertisement