B
Barry
Hi, group
First, I write same cases I've already known, I don't concern that
specific compiler really do inline or not.
Please check them if they are right, and add the cases I miss
1.
// a.h
inline void f() {}
*inline*
2.
//a.h
inline void f();
//a.cpp
#include "a.h"
void f() {}
*NOT* inline, compiler just ignores the keyword
3.
// a.h
class A {
void f1() {}
inline void f2() {}
};
*inline*
4.
// a.h
class A {
inline void f2();
};
//a.cpp
#include "a.h"
void A::f() {}
*not* inline
5.
// a.h
class A {
void f();
};
//a.cpp
#include "a.h"
inline
void A::f() {}
*not* inline
6.
// a.h
class A {
void f();
};
inline void A::f() {}
*inline*
7.
//a.h
template <typename T>
class A {
void f1();
void f2() {}
};
template <typename T>
void A::f1() {}
*inline*
After so many examples,
I sum up from my humble experience, *inline* works comes with the
function definition not the declaration. Is there any exception?
Like
// a.h
class A {
inline void f();
};
void A::f() {}
*inline?*
thanks
First, I write same cases I've already known, I don't concern that
specific compiler really do inline or not.
Please check them if they are right, and add the cases I miss
1.
// a.h
inline void f() {}
*inline*
2.
//a.h
inline void f();
//a.cpp
#include "a.h"
void f() {}
*NOT* inline, compiler just ignores the keyword
3.
// a.h
class A {
void f1() {}
inline void f2() {}
};
*inline*
4.
// a.h
class A {
inline void f2();
};
//a.cpp
#include "a.h"
void A::f() {}
*not* inline
5.
// a.h
class A {
void f();
};
//a.cpp
#include "a.h"
inline
void A::f() {}
*not* inline
6.
// a.h
class A {
void f();
};
inline void A::f() {}
*inline*
7.
//a.h
template <typename T>
class A {
void f1();
void f2() {}
};
template <typename T>
void A::f1() {}
*inline*
After so many examples,
I sum up from my humble experience, *inline* works comes with the
function definition not the declaration. Is there any exception?
Like
// a.h
class A {
inline void f();
};
void A::f() {}
*inline?*
thanks