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.

 

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s