由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - inline functions in C++
相关主题
C编译器为何允许一个函数在某个路径不返回值?c++中的inline 函数是做什么的?
inline function是否可以递归?What happens when recursion functions are declared inline?
interview question: make all class member functions virtual (转载)关于inline function里的static variable
基础问题:在header里面define functionstill confused about inline
A tech question (转载)有什么办法可以查每行代码用的时间?
inline C function in VC++ 2005 express[合集] Inline member function in C++
inline到底能省多少时间?请教问题
请教C++里面这个表达[合集] three worst thing about C++(题目)
相关话题的讨论汇总
话题: functions话题: funcs话题: inline话题: function话题: c++
进入Programming版参与讨论
1 (共1页)
h****e
发帖数: 2125
1
said it's more efficient to put often-used and short functions as inline, so
they are taken care of at compile time, to save function calls overhead and
improve performance thereafter. this I understand, but how do u define "short
functions"?? dozens of lines or a
few hundred lines? or some big functions, I can divide them into smaller
funcs and make them inline?? besides, what bad impact if I make some large
funcs inline?
c********e
发帖数: 383
2
hahahaha,你们两个,等芒果这一阵子吧,到时候要是我来了,就张嘴要钱
呵呵
h****e
发帖数: 2125
3
1. do customers care about compile time?
2. i am working on a server with 32G RAM, size doesn't matter.
3. large functions won't be used very often, otherwise they should be
divided into smaller pieces...

mutator
could
time

【在 c********e 的大作中提到】
: hahahaha,你们两个,等芒果这一阵子吧,到时候要是我来了,就张嘴要钱
: 呵呵

X****r
发帖数: 3557
4
If there are some common parts within many functions, why didn't make them
a separate function in the first place?

funcs

【在 h****e 的大作中提到】
: 1. do customers care about compile time?
: 2. i am working on a server with 32G RAM, size doesn't matter.
: 3. large functions won't be used very often, otherwise they should be
: divided into smaller pieces...
:
: mutator
: could
: time

h****e
发帖数: 2125
5
similarly, many things can be made a function. for example,
a large func goes through a small block A, and another small block b is used
by some other funcs. a and b share about 60% logic, r u gonna make a function
including both case a and b or not? u know, even totally different logic can
be in one function as well, just use a if/switch branch...

【在 X****r 的大作中提到】
: If there are some common parts within many functions, why didn't make them
: a separate function in the first place?
:
: funcs

X****r
发帖数: 3557
6
If there are some common parts within many functions, why didn't make them
a separate function in the first place?

funcs

【在 h****e 的大作中提到】
: similarly, many things can be made a function. for example,
: a large func goes through a small block A, and another small block b is used
: by some other funcs. a and b share about 60% logic, r u gonna make a function
: including both case a and b or not? u know, even totally different logic can
: be in one function as well, just use a if/switch branch...

h****e
发帖数: 2125
7
1. do customers care about compile time?
2. i am working on a server with 32G RAM, size doesn't matter.
3. large functions won't be used very often, otherwise they should be
divided into smaller pieces...

mutator
could
time

【在 c********e 的大作中提到】
: hahahaha,你们两个,等芒果这一阵子吧,到时候要是我来了,就张嘴要钱
: 呵呵

h****e
发帖数: 2125
8
similarly, many things can be made a function. for example,
a large func goes through a small block A, and another small block b is used
by some other funcs. a and b share about 60% logic, r u gonna make a function
including both case a and b or not? u know, even totally different logic can
be in one function as well, just use a if/switch branch...

【在 X****r 的大作中提到】
: If there are some common parts within many functions, why didn't make them
: a separate function in the first place?
:
: funcs

h****e
发帖数: 2125
9

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~faint, I mean some common parts within all funcs
of course.
case,

【在 X****r 的大作中提到】
: If there are some common parts within many functions, why didn't make them
: a separate function in the first place?
:
: funcs

1 (共1页)
进入Programming版参与讨论
相关主题
[合集] three worst thing about C++(题目)A tech question (转载)
在看the effective C++languageinline C function in VC++ 2005 express
static variable in template headerinline到底能省多少时间?
请问C++返回值和返回引用区别请教C++里面这个表达
C编译器为何允许一个函数在某个路径不返回值?c++中的inline 函数是做什么的?
inline function是否可以递归?What happens when recursion functions are declared inline?
interview question: make all class member functions virtual (转载)关于inline function里的static variable
基础问题:在header里面define functionstill confused about inline
相关话题的讨论汇总
话题: functions话题: funcs话题: inline话题: function话题: c++