Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 03 Jul 2003
Online Last Active Today, 12:42 AM

Topics I've Started

How do you pronounce 'ptr'?

13 November 2015 - 11:57 AM

I've been watching a number of the CppCon talks on YouTube, and it's bothering me that Herb Sutter pronounces the variable name ptr as 'put-er' (as in, one who puts things somewhere).


Now, Herb has been at this a lot longer than most of us, so he's probably in good company, but I've always pronounced it as if it wasn't an abbreviation (i.e. 'pointer').


I'm curious how the rest of you pronounce it?

Game development twitch streams?

21 June 2015 - 02:06 PM

I've started to get into watching this Twitch thing (basically, just leaving streams playing while I work). And it's very easy to find streams of people playing games, but I'm more interested in the development side of things...

Any enterprising GDNet'ers out there streaming their development process? Know of any good game development streams, or lists thereof?

IOTD comments/discussion?

24 May 2014 - 08:52 AM

For a while we suffered from a lack of GDNet-submitted images, and had to switch to sourcing the IOTD (Image Of The Day) from the #screenshotsaturday twitter images. I'd say this has to all appearances been very successful, but somewhere along the way we seem to have lost in this transition is the ability to comment on the IOTDs. And I'm sad about this, because my experience was that some of the liveliest discussion threads on the old GDNet were around the IOTD galleries.


Now, I'd love to reboot that lively discussion, but having the images sourced from twitter presents some complications - primarily, the fact that the creator of any given IOTD image may or may not have an account here on GDNet. I'm worried that the image's creator may not know that the image is being commented on and discussed on our forums, and may not be able to respond and/or defend himself if the discussion turns unpleasant.


This doesn't have to be an insurmountable problem:

  • We have fairly aggressive moderation of abusive comments across the site (would you agree?).
  • We have twitter login integration, so any twitter user should be able to login here (does it work? I've never tried).
  • We could potentially tweet back a reply with a link to the discussion here (might be construed as spam?).

So I guess my question is: what do you all think about this?

Strange array overflow (aka WTF I missing here?)

08 April 2014 - 09:14 PM

So I have this fun little function, which reliably crashes at line D (commented below), only if TILE_SIZE is set to an odd number:
const int TILE_SIZE = 7;

Tile *create(const std::array<vector3, 4> &corners) {
   std::vector<vector3> verts; // line A
   std::array<vector3, TILE_SIZE/2> past; // line B

   for (int i = 0; i < TILE_SIZE; ++i) {
      vector3 hi = cml::lerp(corners[0], corners[1], i / float(TILE_SIZE-1));
      vector3 lo = cml::lerp(corners[3], corners[2], i / float(TILE_SIZE-1));

      for (int j = 0; j < TILE_SIZE; ++j) {
         vector3 v = cml::lerp(lo, hi, j / float(TILE_SIZE-1)) );

         if (((i & 1) == 0 || i == TILE_SIZE-1) && ((j & 1) == 0 || j == TILE_SIZE-1)) {
            past[j/2] = v; // line C

         verts.push_back(v); // line D

// ...
The debugger tells me that this is because the verts array has an impossibly large size, which can be fixed by increasing the size of the past array by 1, commenting line C, or swapping lines A and B.

"Array overflow", you say, "silly dev has an off-by-one error in line C", you say. And I'd agree with you, except I can't see it for the life of me. With TILE_SIZE=7, the past array should have a length of 7/2=3, and the inner for loop counts up to (7-1)/2=3, which seems fine, and has been validated with much printf-debugging...

Any ideas to relieve my current anxiety?

C++ trivia

21 January 2014 - 09:17 AM

Everyone knows that taking a reference to a temporary is a bad idea:
int getX() {
    return 5;

int &x = getX();
But how about a const reference?
int getY() {
    return 10;

const int &y = getY();
It turns out that unlike the first case, storing a const reference to a temporary actually extends the lifetime of the temporary to lifetime of the const reference (read Herb Sutter on the topic).
Entertainingly enough, I learned this piece of C++ trivia when Coverity's static analysis tool tried to tell me that returning a const reference to a temporary was illegal. All I can say is yay for code checking tools that don't understand the C++ standard...