Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
![](/static/devrant/img/pipeless-devrant-banner-white.png)
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
benrooke848yI'm not sure what heap corruption has to do with points outside the container. It's not uncommon for drawing libraries to let you specify points beyond the bounds. In iOS, you can specify any x,y you'd like. There's a separate method for detecting if points are within a rect.
Perhaps you could add a method that checks if the point is inside the rectangle? And then you could add another method that does both the call to retrieve the coordinate pointer, and checks that the point is within the bounds. -
kerith2968yI didn't know it was common :).
anyways, it's certainly my fault for writing outside the surface, I was just venting at my frustration with myself. Once I figured out that writing outside bounds was the problem, it was easy to fix.
@benrooke
Related Rants
-
xjose97x18Just saw a variable in C named like this: long time_ago; //in a galaxy far away I laughed no stop.
-
Unskipp24So this happened last night... Gf: my favorite bra is not fitting me anymore Me: get a new one ? Gf: but it ...
-
sam966911
Hats off to this lady .... I would have just flipped the machine
I am working on an open source game project, and the most common way to draw things is using a class named ManagedSurface. The class is otherwise awesome, but it has a method called getBasePtr(x, y), which gives you a pointer to the requested coordinates. Fair enough (this is C++ without STL by the way).
But WHY THE HELL CAN I REQUEST ANY POINTER THAT I WANT, EVEN IF IT'S OUTSIDE THE SURFACE? Other cointainers have sanity checks, asserts and such, and the surface KEEPS TRACK OF IT'S WIDTH AND HEIGHT.
WAS IT SO FUCKING HARD TO ADD assert(x <= w); assert(y <= h);???
I spent 3 days on valgrind trying to find a heap corruption that manifested at random points in the code.
FUUUUCK!
On the bright side, I learned how to use valgrind (which is awesomely awesome).
undefined
heap corruption
pointers
c++