Modding, Mission Design, and Coding > Cross-Platform Development

gcc 2.95

(1/4) > >>

fizz:
Hi,

I came across FS2Open recently and yesterday decided to give the CVS version a try. Unofrtunately, fs currently cannot be built with gcc 2.95, mainly because that version apparently doesn't properly separate the std namespace and therefore the vector type fs uses clashes with std::vector.

Would a patch renaming the vector type be accepted? I'll happily create one if you let me know of an acceptable alternate name.

I did have to patch a few more places, but the vector errors account for more than 99% of the changes. I haven't had the time to check whether it actually works, though :rolleyes:

WMCoolmon:
AFAIK, vector is a fairly common name for 3D applications. Isn't there a somewhat less intrusive way of making the change? AFAIK, std::vector is only used in a few places in the code.

fizz:
I can't think of one (which of course doesn't mean much). The problem is that when you include <vector>, std::vector is not properly namespaced, so you basically end up with two definitions for vector.

What might be possible is to separate all uses of std::vector into their own files. They must not use the fs vector at the same time though, and this of course makes it impossible to use in header files included by other sources. And it'll break again as soon as someone not using gcc 2 crosses that fine line. I don't know the fs codebase so I'm not sure if this is feasible, but even if it was, I'm not sure it's a better solution.

EDIT: Gr... stupid HTML...

taylor:
Does -fhonor-std help any?  Never had to use it myself but a Google search turned that up.  From the docs:

--- Quote ---Treat the namespace std as a namespace, instead of ignoring it. For compatibility with earlier versions of g++, the compiler will, by default, ignore namespace-declarations, using-declarations, using-directives, and namespace-names, if they involve std.
--- End quote ---

It will depend on how it's used in the files in question but it might make the difference and not require a ton of code changes.  I know that gcc 2.95 is still used but it's rather old at this point and unless the changes are very minor and don't require any sort of work around for other compilers then support for it will be officially dropped.  It's not worth supporting if it takes that much effort and gcc 3+ will become the minimum requirement.

fizz:
That sounds like it's an option for newer g++, but I'll try it.

It would be sad to drop support for gcc 2, though, especially as there seems to be no good reason for it. Sure, the patch would touch a lot of files, but the changes are absolutely trivial and should be transparent to other compilers. As I mentioned in my first post, apart from this issue, there were only very minor corrections needed to make it compile.

Navigation

[0] Message Index

[#] Next page

Go to full version