[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C++: Problem with overloading a constructor when splitting a
- To: Dan Kenigsberg <danken(at-nospam)cs.Technion.AC.IL>
- Subject: Re: C++: Problem with overloading a constructor when splitting a
- From: Adi Stav <stav(at-nospam)actcom.co.il>
- Date: Sun, 18 Nov 2001 19:15:35 +0200
- Cc: nobody(at-nospam)cs.Technion.AC.IL, linux-il(at-nospam)linux.org.il
- Delivered-To: linux.org.il-linux-il@linux.org.il
- In-Reply-To: <200111181047.MAA15673@csd.cs.technion.ac.il>; from danken@cs.Technion.AC.IL on Sun, Nov 18, 2001 at 12:47:20PM +0200
- Mail-Followup-To: Dan Kenigsberg <danken@cs.Technion.AC.IL>,nobody@cs.Technion.AC.IL, linux-il@linux.org.il
- References: <Pine.GSU.4.30_heb2.09.0111180211330.22738-100000@actcom.co.il> <200111181047.MAA15673@csd.cs.technion.ac.il>
- Sender: Adi Stav <adi(at-nospam)stav.org.il>
- Sender: linux-il-bounce(at-nospam)cs.huji.ac.il
- User-Agent: Mutt/1.2.5i
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