Re: Strange syntax error problem with mmorpg-framework

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John Love-Jensen wrote:
Hi Alex,

The problem is probably in the expansion of the macros.

From the macros visible in the trunk/src/game/Player.cpp [5122:5445] diff,
it is not apparent what the problem is, since not all macros involved are
available in that diff.
The player.cpp source is directly available via http://www.mangosproject.org/trac/browser/trunk/src/game/Player.cpp?rev=5126&format=raw , if you find time to have a look at it ...
It appears that someone tried to make accessing the "value index" more
regular, by introducing a PLAYER_SKILL_VALUE_INDEX macro function.  Perhaps
a glitch was introduced as well.

I opened player.cpp and search for "PLAYER_SKILL_VALUE_INDEX". I found the following at the beginning (nearly) of the file:

----code----
#define PLAYER_SKILL_VALUE_INDEX(x) (PLAYER_SKILL_INDEX(x)+1)
----/code----

Looks like the macro you mentioned?!

The "funny" thing is: This error's doesn't appear on all user's machines. There are many users out there who don't have this problems. So the errors aren't a real blocker. And that's why I'm so confused. The devs say, that gcc 4.x.y should work fine and don't have this problems. Is it possible that a library that gcc uses is not up2date for using those macros?
In general, for C++, I strongly recommend avoiding macro functions and macro
constants.  Instead, use the C++ facilities of inline functions and const
identifiers.

There are a few exceptions to my C++ rule-of-thumb, such as assert macro
functions.  But the exceptions to the rule are very few.

My advice is probably too late for the developers to adopt.  Alas.
I will post this to the devs... Maybe it's not "too late" ;-)

You may be able to identify the problem if you compile that .cpp file with
the g++ -E switch, and look at the post-preprocessed output.

Sincerely,
--Eljay


I will have to look at the created makefile to enable this switch ...

so far, thanks for your help.

br,
Alex

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux