Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 parse description bug
Yesterday, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Google, Yandex

Members: 0
Guests: 4
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » g++ and gcc macro question
Forum Rules | Mark all | Recent Posts

g++ and gcc macro question
< Newer Topic :: Older Topic > non stock smaug1.2a and g++

Pages:<< prev 1 next >>
Post is unread #1 Oct 6, 2012, 11:01 pm
Go to the top of the page
Go to the bottom of the page

Stan
Fledgling
GroupMembers
Posts23
JoinedNov 19, 2005

Hello,
I applied the g++ 4.6 unused variables patch by Andril, I applied it by hand. My code is not stock, its a swr1.0 derivative that compiles with gcc as opposed to g++. My idea is to make the code g++ compatible in baby steps.
On the mac, using gcc version 4.2 I noticed IO errors sent to the logger, 'fMatch [not found]'. This is in relation to the <code>#define KEY( literal, field, value )</code> macro. What makes sense given my skill level in programming is to begin the c++ conversion in a year or two. I have yet to apply const correctness to the source code. I recall Kavir posted a diff file in the SmaugMuds or MB forums some time ago but I've lost the link.
As I peruse the GCC 4.7.2 reference manual the paragraph from 10.1 Introduction to gcov holds my interest.

"
If you use complicated macros that expand to loops or to other control structures, the statistics are less helpful—they only report on the line where the macro call appears. If your complex macros behave like functions, you can replace them with inline functions to solve this problem.
"
In the C programming language is a inline function a practical replacement of the Key macro?
       
Post is unread #2 Oct 7, 2012, 7:24 pm
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

Not really. The thing with macros is, they do literal text replacements on chunks of code before the compiler processes it (via the preprocessor). Most simple macros are easy enough to replace.

#define FOO 13
#define BLAH(x) this_thing->foobar((x))

But a complex macro often has side effects, and in the case of the KEY macro, it sets global variables which other chunks of code rely on. You could easily rewrite the system to not do that, but just swapping the macro for a function (inline or not) will not be a one-to-one replacement.
       
Pages:<< prev 1 next >>