3

Guru of the Week

 3 years ago
source link: http://www.gotw.ca/gotw/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

GotW Archive (Most Recent First)

Issue #Title and Description#88
(January 1, 2008)A Candidate For the "Most Important const." When you bind a temporary object to a reference, what are the semantics and consequences... exactly?#87
(May 17, 2003)

Two-Phase or Not Two-Phase, Part 1: The Story of Dependent Names in Templates. In the land of C++, there are two towns: The village of traditional nontemplate C++ code, and the hamlet of templates. The two are tantalizingly similar, and so many things are the same in both places that visitors to the templates hamlet might be forgiven for thinking they're right at home, that the template programming environment is the same as it was in their familiar nontemplate surroundings. That is a natural mistake… but some of the local laws are different, often in subtle ways, and some classic assumptions must be unlearned before one can learn to write template code correctly and portably. This articles explores these small but important differences, and how they will soon increasingly affect your code.

#86
(December 30, 2002)

Slight Typos? Graphic Language and Other Curiosities. Sometimes even small and hard-to-see typos can accidentally have a significant effect on code. To illustrate how hard typos can be to see, and how easy phantom typos are to see accidentally even when they're not there, consider these examples.

#85
(August 7, 2002)

Style Case Study #3: Construction Unions. No, this issue isn't about organizing carpenters and bricklayers. Rather, it's about deciding between what's cool and what's not, good motivations gone astray, and the consequences of subversive activities carried on under the covers. It's about trying to get around the C++ rule of using constructed objects as members of unions...

#84
(February 24, 2002)

Monoliths "Unstrung." "All for one, and one for all" may work for Musketeers, but it doesn't work nearly as well for class designers. Here's an example that is not altogether exemplary, and it illustrates just how badly you can go wrong when design turns into overdesign. The example is, unfortunately, taken from a standard library near you...

#83
(February 13, 2002)

Style Case Study #2: Generic Callbacks. Part of the allure of generic code is its usability and reusability in as many kinds of situations as reasonably possible. How can the simple facility presented in the cited article be stylistically improved, and how can it be made more useful than it is and really qualify as generic and widely-usable code?

#82
(June 30, 2001)

Debate #1: Exception Safety and Specifications -- Are They Worth It? Is it worth the effort to write exception-safe code? Are exception specifications worthwhile? It may surprise you that these are still disputed and debated points, and ones where even experts may sometimes disagree.

#81
(May 10, 2001)

Constant Optimization? Does const-correctness help the compiler to optimize code? Most programmers' reaction is that, yes, it probably does. Which brings us to the interesting thing...

#80
(Mar 31, 2001)

Order, Order! Programmers learning C++ often come up with interesting misconceptions of what can and can't be done in C++. In this example, contributed by Jan Christiaan van Winkel, a student makes a basic mistake -- but one that many compilers allow to pass with no warnings at all.

#79
(Feb 18, 2001)

Template Typedef. This GotW exists to answer a recurring question about C++ syntax: When, and how, could you make use of a template typedef?

#78
(Jan 31, 2001)Operators, Operators Everywhere. How many operators can you put together, when you really put your mind to it? This issue takes a break from production coding to get some fun C++ exercise.#77
(Dec 25, 2000)#Definition. What can and can't macros do? Not all compilers agree.#76
(Dec 8, 2000)Uses and Abuses of Access Rights. Who really has access to your class's internals? This issue is about liars, cheats, pickpockets, and thieves, and how to recognize and avoid them.#75
(Oct 15, 2000)Istream Initialization? Most people know the famous quote: "What if they gave a war and no one came?" This time, we consider the question: "What if we initialized an object and nothing happened?" As Scarlett might say in such a situation: "This isn't right, I do declare!"#74
(Sep 30, 2000)Uses and Abuses of Vector. Almost everybody uses std::vector, and that's good. Unfortunately, many people misunderstand some of its semantics and end up unwittingly using it in surprising and dangerous ways. How many of the subtle problems illustrated in this issue might be lurking in your current program?#73
(Aug 27, 2000)Style Case Study #1: Index Tables. This GotW introduces a new theme that we'll see again from time to time in future Style Case Study issues: We examine a piece of published code, critique it to illustrate proper coding style, and develop an improved version. You may be amazed at just how much can be done even with code that has been written, vetted, and proofread by experts.#72
(Jul 31, 2000)Data Formats and Efficiency. How good are you at choosing highly compact and memory-efficient data formats? How good are you at writing bit-twiddling code? This GotW gives you ample opportunity to exercise both skills, as we consider efficient representations of chess games and a BitBuffer to hold them.#71
(Jun 30, 2000)Inheritance Traits? This issue reviews traits templates, and demonstrates some cool traits techniques. What can a template figure out about its type -- and then what can it do about it? The answers are nifty and illuminating, and not just for people who write C++ libraries.#70
(May 17, 2000)Encapsulation. What exactly is encapsulation as it applies to C++ programming? What does proper encapsulation and access control mean for member data -- should it ever be public or protected? This issue focuses on alternative answers to these questions, and shows how those answers can increase either the robustness or the fragility of your code.#69
(Apr 11, 2000)Enforcing Rules for Derived Classes. Too many times, just being at the top of the (inheritance) world doesn't mean that you can save programmers of derived classes from simple mistakes. But sometimes you can! This issue is about safe design of base classes, so that derived class writers have a more difficult time going wrong.#68
(Mar 26, 2000)Flavors of Genericity. How generic is a generic function, really? The answer can depend as much on its implementation as on its interface, and a perfectly generalized interface can be hobbled by simple -- and awkward-to-diagnose -- programming lapses.#67
(Feb 29, 2000)Double or Nothing. No, this issue isn't about gambling. It is, however, about a different kind of "float," so to speak, and lets you test your skills about basic floating-point operations in C and C++.#66
(Jan 29, 2000)Constructor Failures. What exactly happens when a constructor emits an exception? What if the exception comes from an attempt to construct a subobject or member object? This issue of GotW analyzes one aspect of C++ in detail, shows why it should work the way that it does, and demonstrates the implications for constructor exception specifications.#65
(Jan 3, 2000)Try and Catch Me. Is exception safety all about writing try and catch in the right places? If not, then what? And what kinds of things should you consider when developing an exception safety policy for your software?#64
(Dec 8, 1999)Standard Library Member Functions. Reuse is good, but can you always reuse the standard library with itself? Here is an example that might surprise you, where one feature of the standard library can be used portably with any of your code as much as you like, but it cannot be used portably with the standard library itself.#63
(Nov 10, 1999)Amok Code. Sometimes life hands you some debugging situations that seem just plain deeply weird. Try this one on for size, and see if you can reason about possible causes for the problem.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK