GDC 2008 Slides


 
I’ve had a lot of requests for my GDC presentation from last Thursday. Although I’ve made the slides available to the good people at CMP for posting on gdconf.com, they aren’t available yet. You can find a copy on my personal website by pointing your browser at http://www.tantalon.com/pete.htm.
 
A couple people mentioned an error in my talk. I showed some code like this:
char* s = "abcdef";
char u[] = "bcd";
u[0] = ‘x’; // danger
According to the C++ Standard the string "bcd" could overlap with the string "abcdef". That’s incorrect, because "bcd" must end with the null character. I’ve adjusted my slides to show something accurate:
char* s = "abcdef";
char u[] = "def";
u[0] = ‘x’; // danger

Now "def" could indeed overlap with "abcdef" and changing "def" could change the "abcdef" string. Big takeaway: don’t modify string literals.

 

This entry was posted in C++. Bookmark the permalink.

Leave a comment