Xcode to Visual Studio

Started by
4 comments, last by DanielSzekely 12 years, 6 months ago
So I've recently tried porting my game from Mac (compiled under Xcode 4) to the Windows platform (compiled using Visual Studio 2008).

I eventually got it working fine, but upon execution, it crashes like never before. It turns out, there's some null memory being tossed around and bad iterator accessing data it shouldn't.
All of this was only discovered with a few minutes of debugging and I don't even know how many are actually there.

So, it pisses me off that Xcode and Mac did not detect these things (and some of them were just plain obvious). Now, I've told my small group of followers that the demo I was wrapping up is delayed yet again until I can track down all these bugs in Windows.

WHY. That sort of sloppy build-work shouldn't be allowed as a compiler. D: Is there any other reason for this?
I'm that imaginary number in the parabola of life.
Advertisement
Code that is syntactically legal will usually get compiled without too many warnings from compilers. Most bugs can only be caught at runtime. Most compilers, in debug builds, will initialize variables to certain values. The value depends on the compiler and the object type. Anyway, sometimes the value is ok for your program, and you may have built it so it handled GCC's (Xcode's compiler) default initial values, but it wasn't built to handle Visual Studio's default values, hence you started to see the bugs. Or perhaps there weren't any default values in the Xcode debug builds, and the memory the objects were assigned to were filled with data that just happened to be what your program was expecting, but on the other computer this memory was not filled with the right data, hence you started to catch the bugs.

There's a few possibilities. Undefined behavior is a bi***.
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

So, it pisses me off that Xcode and Mac did not detect these things (and some of them were just plain obvious).

If the compiler is not required by the standard to issue a diagnostic, it may not. With that said, which compiler warnings did you enable when building with GCC? I recommend "-W -Wall -Werror" at a minimum.

That sort of sloppy build-work shouldn't be allowed as a compiler.[/quote]
When you start blaming the compiler, it's a slippery slope. Take this opportunity to learn from the experience. Visual C++ won't catch everything either (in fact it and GCC each catch different things, though there is a lot of overlap).

Trouble can be avoided to a large extent by adding asserts and tests. Though a compiler may add additional diagnostics to that which the standard requires, it shouldn't be expected.

The C family of languages (one of which I assume you are using) are brutal and unforgiving. If you're unable sustain the attention to detail required, you could perhaps try another language?
On two occasions I have been asked,—"Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.

Charles Babbage, Passages from the Life of a Philosopher[sup][2][/sup]
[size=2]If the compiler is not required by the standard to issue a diagnostic, it may not. With that said, which compiler warnings did you enable when building with GCC? I recommend "-W -Wall -Werror" at a minimum.


Honestly, I'm not sure. I'll definitely note that. Thanks.

[color=#1C2837][size=2]

[color=#1C2837][size=2]

[color="#1c2837"]I am paying attention to detail as much as possible, which again, was why I become frustrated with it. It's not a small game. There's over thousands of lines of code in it and I've been working on it for a few years as it has grown. The library is portable, so the 'heavenly thought' would be I send it over to VS2008, maybe fix a few small bugs, and be done. Not literally crashing upon execution.

I suppose this post was primarily an unfair rant.
[color=#1C2837][size=2]
[quote name='Antheus' timestamp='1318887148' post='4873641']
On two occasions I have been asked,—"Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.

Charles Babbage, Passages from the Life of a Philosopher[sup][2][/sup]



Cute quote, but I did not run about intentionally putting in wrong values. There's something wrong with the level-loading code. On Mac, everything runs just nifty. On Windows, it practically crashes on every new scene in a second flat. I haven't had the time since the other day to stop and look at it, but I was very mind-boggled over the whole scenario. A few bugs I was expecting, but not major routines (and the reason they say they are crashing); that is what frustrated me the most.
I'm that imaginary number in the parabola of life.
And you have no logging mechanism to figure out just where things go wrong?

This topic is closed to new replies.

Advertisement