C++ Exception Handling

C++, Error Handling No Comments »

Quick quiz: What is the behavior of the following code:

#include <stdio.h>

int main(int argc, char* argv[])
{
    try
    {
        *((char*) 0) = 1;
    }
    catch (...)
    {
        printf("Caught exception.\n");
    }

    return 0;
}

The answer is below the fold.

Read the rest of this entry »

Retrieving Compiler Predefined Macros for gcc

C, C++ No Comments »

To retrieve the list of macros that gcc predefines, execute the following command:

gcc -E -dM - < /dev/null

Implementing IXmlWriter Series

C++, XML No Comments »

While I had originally planned on stretching out my Implementing IXmlWriter series of posts into at least three or four more posts, I’ve decided to end it here. Here is a list of the posts in the series:

Off the top of my head, here are a few things left to implement:

  • Processing instructions
  • Doc type declarations
  • CDATA declarations
  • Entity references
  • Character entities
  • Character encodings (e.g. UTF-8, UTF-16, etc.)
  • Robust error handling, such as throwing an exception if WriteAttribute() is called with an illegal character

Update: 2007-07-11 10:58 PM: Microsoft’s XmlLite provides all this and more for Windows developers.

Implementing IXmlWriter Part 14: Supporting Writing To A Stream

C++, XML No Comments »

Today I will add support for writing the generated XML to a C++ stream to last time’s IXmlWriter.

Read the rest of this entry »

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in