John Levon <[EMAIL PROTECTED]> writes:
| > and widh_this.size() is inlined and do_something segfaults, the
| > segfault can look like it happened inside with_this.size().
|
| and this is reason enough to not have this speedup ??
Yes, I belive a more detrministic development environment is reason
enough.
And as said, I am thinking about schemes to inline importent small
methods again, but not just now.
| > Also when having inlines in the header file, alway put the inlined
| > method after the class definithin with an inline, in the class inline
| > should not be used:
|
| ok, sorry
|
| > #ifdef INLINE_SIMPLE_METHODS
| > #define INLINE inline
| > #include "foo_inlines.h"
| > #endif
| >
| > foo_inlines.h:
| > INLINE
| > Foo::size() {
| > return ...;
| > }
| >
| > foo.C:
| > #ifndef INLINE_SIMPLE_METHODS
| > #define INLINE
| > #include "foo_inlines.h"
| > #endif
|
| well as described, if not inlined this will have copies of Foo:size()
??? yes, that was the purpose...
| Also I don't think IMHO it makes sense to inline hardly-used accessor methods
| (or maybe it does). I suppose it depends on architecture what kind of effect
| this will have on .text size
One-liner getter methods will almost alway inline perfectly and
generate less code than a "full" method. So I belive that in most
cases getters should be made inline, most of the setters should be
inline (if very simple). Methods that are only wrappers around other
methods can be inlined.
Lgb