Browse by Tags

Tagged Content List
  • Blog Post: More on Getting the Number of Array Elements

    In a previous post , I discussed a safer way to get the number of elements in a C++ array. I mentioned that the countof() macro doesn’t work with local types (i.e. types defined inside a function definition). I just realized that the macro also fails to work with anonymous types under certain circumstances...
  • Blog Post: Programming in XSLT!

    Not so long ago, I posted a programming challenge , and received solutions in many different languages. Just when I thought people had forgot about this, I got this one from Anton Triest . It was written in a programming language called ... (surprise) XSLT ! Ask not what you can do in XSLT; ask what...
  • Blog Post: Generalize Smart Pointers in C++

    After programming in C++ for a while, you will inevitably be introduced to the concept of “smart pointers” (or you will discover them on your own). These are pointers that know to automatically release the objects they point to when they (the pointers) are destructed. They have proved quite...
  • Blog Post: Using template specialization in C++

    We all know that C++ templates can be used to write generic code, e.g. template <typename T> class Array { … }; Then we can use the same template to generate code for different template parameters. This is called instantiation of the template. e.g. Array<int> x;...
  • Blog Post: Using C++ Member Function Pointers

    I don't know about you, but the C++ syntax for member function pointers always eludes me. Every time I would spend half an hour or more deciphering MSDN to get the exact syntax, only to completely forget it the next time. Oops. I can think of three reasons why this is happening: The C...
  • Blog Post: How Would You Get the Count of an Array in C++?

    The question is simple: given a C++ array (e.g. x as in int x[10] ), how would you get the number of elements in it? An obvious solution is the following macro ( definition 1 ): #define countof( array ) ( sizeof ( array )/ sizeof ( array[0] ) ) I cannot say this isn’t correct...
  • Blog Post: Improve Longhorn code quality

    Starting the coming Monday (July 12, 2004), I will be working for the Windows devision instead of Visual Studio. My new team is focusing on improving the quality of the Longhorn code base. I might write more about it once I get an idea on what it is really like there. I would love to hear your suggestions...
  • Blog Post: Welcome, Aaron!

    I'm glad to see Aaron Stebner started blogging about setup (installer). Before Aaron switched team, he was a QA lead in the VS / .NET setup team, which I'm working for. He was a great resource then. Looks like his posts will be a new valuable source of information for my work. I expect them to be...
  • Blog Post: How Would You Get the Count of an Array in C++?

    The question is simple: given a C++ array (e.g. x as in int x[10] ), how would you get the number of elements in it? An obvious solution is the following macro ( definition 1 ): #define countof( array ) ( sizeof ( array )/ sizeof ( array[0] ) ) I cannot say this isn’t correct...
  • Blog Post: A JScript entry to the Phaser chanllenge

    You probably have got tired of me, and my phone number phraser chanllenge , but you should check this one out. Today I got a JavaScript (!) program that solves the phraser problem from Nicholas Allen. This one is surprisingly short, and fairly clear too. I have to study JScript sometimes. ...
  • Blog Post: One more entry to the Phaser challenge

    Since I keep receiving entries to my programming challenge , I’ve compiled a list . New entries will be added to that list as they are received. Last Saturday (4/3/04) I received another C# solution from Frans Bouma. In his own words: “Hi, This week I started my phraser...
  • Blog Post: Solutions to the Phraser programming challenge

    On 3/29/04 I posted a programming challenge : given a telephone number, find all possible ways to represent it using English words and digits. Several people have submitted their solutions. This page contains a list of all the entries I received, in the order of submission. It will be updated as I receive...
  • Blog Post: My own solution to my programming challenge

    I posted this programming puzzle on Monday this week, and have received a solution in Fox Pro from Calvin Hsia, one in C# from Justin Rodgers, and one in C++ from Michael Scholz. So we have 3 players using 3 different languages. Cool! I promised to post my own solution, and here you go. I even...
  • Blog Post: Another entry to the phraser programming contest

    I received another entry to my programming contest in email: From: "Michael Scholz" Sent: Thursday, April 01, 2004 5:34 PM I started working on your programming contest, but I quickly tired of optimizing for how-clear-the-code-is. But then, when you posted some clear code with the slow...
  • Blog Post: Entries to my programming challenge

    Calvin submitted the first entry to my programming challenge . And (surprise!), it’s in Visual Fox Pro . I didn’t know Fox Pro can do that! It’s always nice to see unconventional ways to solve a problem. Calvin’s post includes the source code, comments, and some anecdotes...
  • Blog Post: Programming Challenge: Phraser

    Want to prove that you are the best programmer money can buy? (OK, I know you are not for sale, but your boss may need a friendly reminder that it's time for your next big raise.) Here's your chance: On a telephone keypad, the number keys 2 -- 9 also carry letters on them (see the picture below...
  • Blog Post: Comments on an Answer to a Clearest Code Challenge

    Jaybaz_MS posted this Clearest Code Challenge , and later provided his own answer . I wrote some comments (and more ) on it, which you might want to check out.
  • Blog Post: Using C++ Member Function Pointers

    I don't know about you, but the C++ syntax for member function pointers always eludes me. Every time I would spend half an hour or more deciphering MSDN to get the exact syntax, only to completely forget it the next time. Oops. I can think of three reasons why this is happening: The C...
  • Blog Post: Using template specialization in C++

    We all know that C++ templates can be used to write generic code, e.g. template <typename T> class Array { … }; Then we can use the same template to generate code for different template parameters. This is called instantiation of the template. e.g. Array<int> x;...
Page 1 of 1 (19 items)