Tuesday, May 30, 2006

Visual What?

I haven't written in quite awhile... I wish it was because I had been on vacation... far from it, though. The reasons were other:

1) Not much to write about (there is quite the calm before the FSX storm) and
2) Getting ready with our code conversion (we're moving everything from Visual Studio 6 to Visual Studio 2005).

Reason 1 isn't exactly true - the MD-11 is progressing very nicely and I've been trying to find some new technical advisors to complement the existing team, as we're going into beta status soon (I'll be posting a couple pics of the MD-11 panel once I get my hands on a stable alpha release).

Reason 2 is a bit more special: Being spoilt by Microsoft, I wouldn't have expected that the transition would have been so... um... not fun / easy. This was almost senseless - or I haven't found the easier way... :-) To explain:

All our code is written in Microsoft Visual Studio 6 / C++. We had skipped the transition into Visual Studio .NET / .NET 2003, as the Flight Sim 2004 SDKs were still written in VS6 C/C++ and it seemed quite unnecessary to have to bother (let alone find / schedule the time to do it).

Now that FSX is coming out, it appears that the SDKs are going to only support VS2005 - so we had to finally bite the bullet.

One might think - what's the problem - copy the code over to a different hard disk, open the workspace in VS2005 instead, and viola! (sic). Errr - nope. The workspace / project files are seamlessly translated into solutions and vsproj files, but the code itself doesn't compile out the box. In fact, it takes lots of effort and pain to translate: Apparently, the VS6 version of C/C++ wasn't exactly conformant... so there are TONS of warnings / errors that occur...

The main ones: C4244 (arithmetic conversions - float/double, int/short etc. etc.) which are a pain, but at least make sense (if you were bad enough to blindly pass one to the other indiscriminantly) and C4996 - and this one is silly, IMO: It's a warning about the deprecation of all printf/sprintf etc. type commands and their replacement with buffer overflow-safe equivalents, named _s - i.e. sprintf_s etc.

So- instead of a global setting (so we can maintain the code and allow it to also compile well under VS6) to turn those C4996 warnings off, I had to visit all the files and issue #pragma warning disables... Fun.

Anyway - rant off for now, but if someone knows how I could have skipped this pain, let me know too - at least I'll let our friends know as well.

5 comments:

Andrew said...

"if someone knows how I could have skipped this pain, let me know..."

Sorry Lefteris, I have no solution to offer; though it is comforting to know I’m not the only one wading through a load of C4996 warnings! < G >

Lefteris said...

Andrew-

I HATE them ;-). There's a setting you can use for global deprecation suppression, but that's no good, as it'll mask/hide other stuff...

Anonymous said...

Hindsight is 20-20, of course. But, being a seasoned veteran at porting between various platforms (Windows, Linux, Solaris, HP/UX), may I suggest:

When starting a C/C++ project, always abstract your datatypes and C library calls (i.e. use LKint instead of int, and LKsprintf instead of sprintf) LK is the abstraction prefix, and can be anything.

This way, you need only conditionally compile a small number of key header files (and, potentially source files) when porting.

Key mantra is: never, ever code to a specific platform!

- Bill Ruppel

Lefteris said...

So guess what-

I found how to globally suppress these warnings (well- project-globally, anyway):

Click on Project properties, then C/C++ and the Advanced setting. Then add the numbers of the warnings you want to suppress, under "Disable Specific Warnings", and presto! you're done!

Anonymous said...

Good solution, Thanks !