Re: evaluating #defines in gdb?

From: Herbert Kremser (kremser@flinux.tu-graz.ac.at)
Date: 11/03/95


On Fri, 3 Nov 1995, Mark Devlin wrote:

> However, an inline-function version of the macro worked fine, use the 
> 'call' command in gdb to call the function.  It will be inlined for most 
> uses, so there's no overhead.  Also, gives you type safety, almost
> always a good thing.
> 
> An example (with the variables possibly screwed up):
> inline int GET_STR(const struct char_data *ch)
> {
> 	return ch->aff_abils.str;
> }
> 
> Now, I only use gcc and gdb, so I can't make any comments about the rest 
> of the world.  Hope this is still of some use.


inline isn't ANSI-C though. It's the C++ solution to have something
better than macros, and gcc supports this in C-mode too.
So if you always use gcc it's better to use inline functions, if you
want to have portability, don't.  :)
Or maybe you want even to switch to C++, by using it not really as
C++, but as better C. Fully writing it in C++ would be a major project,
but C++ has some further nice things which are rather C, but better than
there, much like the inline functions.

Herbert

[on public request 12 lines of signature deleted]  *snip* ;)



This archive was generated by hypermail 2b30 : 12/07/00 PST