Skip to main content
gamedev.net
Return value corruption

Return value corruption

dcosborn
Journal of dcosborn · · 1 min read
710 0

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

I found a strange bug which was corrupting the return value of a couple of functions. The following code (alone) prints various numbers other than 0 when compiled with my second-hand MinGW GCC 4.1.1:

#include #include int F(){	std::vector<char> buffer;	std::cout << std::endl;	return 0;	std::cout << std::endl;}int main(){	std::cout << F() << std::endl;}

If I remove any of the std::* lines, the problem disappears. So I have to assume this is a library issue, which shouldn't be unexpected because my copy of the standard library has been hacked up quite a bit.

Out of desperation I decided to try, once again, to build GCC under MinGW myself. Fortunately, I stumbled upon Scott Meyers' annotated version of Marcelo Slomp's howto. After clearing out my messy MinGW and installing a fresh copy of 3.4.5, I set about following the howto. And to my surprise, it worked! So I'll soon see whether this return value corruption was my own fault or a real issue.

Other than that, I also implemented row/column slicing (correct term?) into my matrix library using proxies and started on an arbitrary image format conversion function. I'm hoping to render something in the next few days, assuming these bugs go away.

Discussion

Loading comments...