Showing results for August 2009 - Page 3 of 4 - The Old New Thing

Aug 13, 2009
0
0

Common gotchas when writing your own p/invoke

Raymond Chen
Raymond Chen

If you're looking to get into some p/invoke action, you'd be well-served to check out the pinvoke wiki to see if somebody else has done it too. If what you need isn't there, you may end up forced to write your own, and here are some gotchas I've seen people run into: C++ and Win32 are not the same as C# (aka ). In Win32, is ...

Code
Aug 12, 2009
0
0

The wisdom of sev^H^H^Heighth graders: What it means to be an adult

Raymond Chen
Raymond Chen

Since I'm obviously a glutton for punishment, I also helped read eighth grade essays on the same topic: Describe the qualities you consider to be those which make someone an adult. As always, remember that these are just the funny sentences/excerpts. Let me tell you about my parents Entering a no fun zone It's harder than I thought Tautology...

Non-ComputerThe wisdom of seventh graders
Aug 12, 2009
0
0

Why can't I pass a reference to a derived class to a function that takes a reference to a base class by reference?

Raymond Chen
Raymond Chen

"Why can't I pass a reference to a derived class to a function that takes a reference to a base class by reference?" That's a confusing question, but it's phrased that way because the simpler phrasing is wrong! Ths misleading simplified phrasing of the question is "Why can't I pass a reference to a derived class to a function that takes a base c...

Code
Aug 11, 2009
0
0

The wisdom of seventh graders: What it means to be an adult

Raymond Chen
Raymond Chen

I didn't participate in the reading of the seventh grade essays, but I did get some of the more entertaining sentences from that batch. As you may recall, the topic was to describe the qualities you consider to be those which make someone an adult. Students were given 90 minutes, plus one additional hour upon request, equipped only with paper and p...

Non-ComputerThe wisdom of seventh graders
Aug 11, 2009
0
0

Actually, FlagsAttribute can't do more; that's why it's an attribute

Raymond Chen
Raymond Chen

A few years ago, Abhinaba wondered why FlagsAttribute didn't also alter the way enumeration values are auto-assigned. Because attributes don't change the language. They are instructions to the runtime environment or (in rarer cases) to the compiler. An attribute can instruct the runtime environment to treat the function or class in a particular w...

Code
Aug 10, 2009
0
0

Why doesn't String.Format throw a FormatException if you pass too many parameters?

Raymond Chen
Raymond Chen

Welcome to CLR Week 2009. As always, we start with a warm-up. The method doesn't throw a if you pass too many parameters, but it does if you pass too few. Why the asymmetry? Well, this is the type of asymmetry you see in the world a lot. You need a ticket for each person that attends a concert. If you have too few tickets, they won't let you...

Code
Aug 10, 2009
0
0

The wisdom of seve^H^H^H^Hsixth graders: What it means to be an adult

Raymond Chen
Raymond Chen

I was out of town for the grading of the seventh grade essays, so I pitched in with the sixth grade essays instead. The students were asked to think of an adult and describe the qualities that make that person an adult. This topic was not very well received by the students, who deemed it uncreative and boring. While I understand their lack of enthu...

Non-ComputerThe wisdom of seventh graders
Aug 7, 2009
0
0

Not beany enough

Raymond Chen
Raymond Chen

The other night, I was playing a friendly game of Scrabble®, and I managed to play BEANIER* (meaning "with a stronger flavor of beans") onto a triple-word score, crossing the B with an open Y, scoring over 100 points in the process. This sufficiently demoralized the other players that the game turned into "play anything that vaguely r...

Non-Computer
Aug 6, 2009
0
0

The great thing about regular expression engines is that there are so many to choose from

Raymond Chen
Raymond Chen

Back in the days before perl ruled the earth, regular expressions were one of those weird niche features, one of those things that everybody reimplements when they need it. If you look at the old unix tools, you'll see that even then, there were three different regular expression engines with different syntax. You had , , and . Probably more. The ...

Code