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

Re: C++: Problem with overloading a constructor when splitting a



On Sun, Nov 18, 2001 at 12:47:20PM +0200, Dan Kenigsberg wrote:
[snip]
> > by definition - no. you split source - you can't do inline. inline works
> > if you put it in the header file. that's the idea of inline - copying the
> > code to all other sources, rather then having a real function in the
> > resulting object file.
> > 
> 
> This may seem an ugly feature of C++, but in fact it is better than the C
> counterpart - macros.
[snip]

Macros are not the C counterparts of inline functions -- it is 
considered bad style to use macros instead of functions for 
performance reasons (even though I've done it in the past, for 
reasons always too annoying for me to wish to recall). Macros are 
supposed to be used only when you actually need a syntax-level macro.  
A good optimizing C compiler will inline functions automatically, and 
that is normally the recommended solution. 

I agree this is not as flexible as the "inline" keyword, which is 
supported very well in GCC and is standardized in C99, but is not 
implemented in many other, less enlightened C compilers.

=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il