由买买提看人间百态

topics

全部话题 - 话题: inline
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
t****t
发帖数: 6806
1
来自主题: Programming版 - inline到底能省多少时间?
i didn't mean extern-> export, OP implied that. by "external" i (and OP)
meant external linkage. by contrast, function/object with static keyword is
internal linkage, auto objects has no linkage.
for C, mostly that's the case. but for c++, linkage rules are more
complicated, since you have const, inline, anonymous namespace, etc.
the "export" my previous post is not VC export. it's merely some
implementation term. as for you said "extern是说declare不define/implement一
个variable", that's of course no... 阅读全帖
g*********s
发帖数: 1782
2
来自主题: Programming版 - inline function是否可以递归?
觉得不行。
但是,如果一个递归函数声明成inline,compiler怎么识别呢?
g*********s
发帖数: 1782
3
来自主题: Programming版 - inline function是否可以递归?
http://stackoverflow.com/questions/190232/can-a-recursive-funct
这里的例子如果放进类定义,inline就是必须而不是建议了吧?
P********e
发帖数: 2610
4
来自主题: Programming版 - inline function是否可以递归?
不过不应该把函数定义写在.h里,不是good practice。.h都应该只有forward
declaration, 防止不同的compilation unit有multiple definition。
用static or unnamed namespace就把函数意义改变了。
inline用法意义在class的function和free function里面不一样。
h********n
发帖数: 1671
5
来自主题: Programming版 - inline function是否可以递归?
inline就是为了把函数定义写进.h文件而设计的,否则一点用也没有了。将所有的函数
定义都写在.cpp里,一个是结构琐碎、可读性差,再一个是编译器优化非常困难。
P********e
发帖数: 2610
6
来自主题: Programming版 - inline function是否可以递归?
模板有技巧可以hide definition的。不过你说的情况比如一段code经常调用确实存在
,可能inline是个option。static只能在当前compilation unit用了。
q****x
发帖数: 7404
7
来自主题: Programming版 - c++ inline问题 (转载)
这里inline是必须加的,怎么是提示?提示你完全可以不加啊。
t****t
发帖数: 6806
8
来自主题: Programming版 - c++ inline问题 (转载)
ok i remembered wrong, weak symbol is not exactly for this (but it can be
used to implement this). just remember template/inline member are special
cases, multiple definitions are accepted and handled by link editor.
p*********t
发帖数: 2690
9
来自主题: Programming版 - c++ inline问题 (转载)
compiler决定用不用inline.所以,尽量少用.
f******y
发帖数: 2971
10
来自主题: Programming版 - c++ inline问题 (转载)
inline is a hint to compiler, so it is not totally useless.
e*******c
发帖数: 804
11
来自主题: Programming版 - c++ inline问题 (转载)
agree
X::f is defined outside of class but in the header file. The header file is
included in two files, so each will have a copy of X::f definition, and
hence redefinition.
You should either move X::f definition inside class (so the function is
inline, and will have internal linkage), or move it to the implementation
file for class X.
Put function definition in a header file is really bad habit. Also, "using
std" in a header file is the source of a lot of trouble.
d****i
发帖数: 4809
12
来自主题: Programming版 - c++中的inline 函数是做什么的?
就好像你可以在class的定义中直接定义method而不放在C++文件中:
class Foo {
public:
void myFunc() {
//blah blah....
}
};
但是complier可以忽略inline keyword。
T*****u
发帖数: 7103
13
来自主题: Programming版 - c++中的inline 函数是做什么的?
如果这个函数需要叫很多遍,inline就不用叫了,节省运行时间, at the代价of读和
维护的时间。
c*******y
发帖数: 1630
14
来自主题: Programming版 - c++中的inline 函数是做什么的?
那两个回复都不准确,去google c++ faq
里面有一个section关于inline的,详尽一些。
r*****e
发帖数: 792
15
来自主题: Programming版 - c++中的inline 函数是做什么的?
如果没记错的话,那里的解释就是用了inline有可能快也有可能慢,
binary size会变大也可能会变小。
m***x
发帖数: 492
16
来自主题: Programming版 - c++中的inline 函数是做什么的?
现有的compiler 大多忽略inline,它自己决定了怎么办
S*******s
发帖数: 13043
17
来自主题: Programming版 - c++中的inline 函数是做什么的?
去掉inline的后果就是一大堆链接错误
d****i
发帖数: 4809
18
来自主题: Programming版 - override operator[] inline
这个不对吧,C里面没有操作符重载一说,数组的[]就是简单的指针操作,但是上述C++
里面的inline的操作符重载[]是一次函数调用,就会有点overhead,所以即便把中间的
require()去掉,还是比C稍有点performance hit。这个比较一下C和上面的C++生成的
机器码就知道了。
p***o
发帖数: 1252
19
来自主题: Programming版 - override operator[] inline
We are talking about what is 'inline'.
Have you really checked the ASM list? If you see any extra operations,
say for std::vector::operator[], make sure you have read the documents
to turn off all debug helps/assertions.

++
l******t
发帖数: 843
20
链接:http://www.northshoreinline.com
NorthShore Inline Marathon每年9月在明尼苏达州德鲁斯(Duluth, MN)举行,是美
国每年参加人数最多的轮滑赛事,2008年有3000多人参加,其中2000多来自明尼苏达。
今年将于9月19日周六上午比赛,儿童组(Kids Sprints)于9月18日周五晚上开赛。
我已经给3岁半的儿子报名参加5岁以下组的50米。我自己轮滑水平太臭,双推练得还不
利索,体力也跟不上,最长才滑过15mile,就只好报名了半程马拉松(Half Marathon
13.1 mile)。
各位有兴趣的话,报名后联系一下。本来在美国玩儿速滑的中国人就少,速度轮滑的就
更少了,比赛前后见个面多来劲啊。
注意:有意参加的要及早订旅馆,Duluth人口才10多万,接待能力有限。我刚订的9月
18日晚上的旅馆已经不多乐。
l******t
发帖数: 843
21
我自己在国内时,从初中开始学滑冰,高中时得过一次北京市中学生冰上运动会的高中
组速滑第二名。来美国后,在2002年买过一双RollerBlade的娱乐型轮滑,滑了2个月因
为觉得太慢,就放弃了。2007年搬来明尼苏达州Rochester,2008年买了第一双自己的
短道速滑冰鞋,和另一双5x80的速度轮滑鞋。一年多以来,速度轮滑练过5x80、5x84、
5x88、4x100,至比赛前4个月开始练4x110(见图1)。
我儿子从2008年2岁半时,被我开始放到冰上。从今年5月份报名以后才开始用
RollerBlade的娱乐型鞋练轮滑,至比赛前一个半月,开始练真正的速度轮滑4x80,至
比赛前三周开始练4x84(见图2)。
报名缘起 -- Hengmei2
MITBBS自行车版有个大牛Hengmie2,十几年前来美,UW-Madison毕业,练过冰上大道、
短道和速度轮滑,还和几个世界冠军同场竞技过;这人现在北加州一带玩儿铁人三项。
我们2008年在冰球版互相吹捧过。他在今年5月突然撺掇我报名NorthShore Inline
Marathon,那时我还在苦练4x100的双推技术。我本来觉
l******t
发帖数: 843
22
【1】摘要
2012年9月14日和15日,儿子参加了NorthShore Inline Marathon的儿童组比赛(Kids
Sprints)和成人半程马拉松(Half Marathon)。
今年仍然有3000多人参赛,除传统的全马和半马轮滑、和从去年新增设的旱地滑雪比赛
以外,又增设了半马跑步;另外,为了照顾一些疯狂的长距离轮滑爱好者,今年又增设
了“半马+全马”的combined组。
成绩
Kids Sprints:男孩6-7岁组共10人,75米冲刺赛,第1名;
Half Marathon:61分22秒完成。所在男子12岁及以下组共14人,排名第3;在156名男
子选手中排名第62;总共376名有电子成绩的半马选手中排位第92 / 376。
照片里,是儿子和我们同一个镇子的姐弟俩参加完Kids Sprints的合影。
l******t
发帖数: 843
23
【1】摘要
2012年9月14日和15日,儿子参加了NorthShore Inline Marathon的儿童组比赛(Kids
Sprints)和成人半程马拉松(Half Marathon)。
今年仍然有3000多人参赛,除传统的全马和半马轮滑、和从去年新增设的旱地滑雪比赛
以外,又增设了半马跑步;另外,为了照顾一些疯狂的长距离轮滑爱好者,今年又增设
了“半马+全马”的combined组。
成绩
Kids Sprints:男孩6-7岁组共10人,75米冲刺赛,第1名;
Half Marathon:61分22秒完成。所在男子12岁及以下组共14人,排名第3;在156名男
子选手中排名第62;总共376名有电子成绩的半马选手中排位第92 / 376。
照片里,是儿子和我们同一个镇子的姐弟俩参加完Kids Sprints的合影。
g******y
发帖数: 2517
24
Save up to 50% on K2 Kids' Inline Skates轮滑鞋
http://amzn.to/HSzu5q
w******t
发帖数: 16937
25
来自主题: Living版 - 想设计个logo
分特,想看专业的?
看这个。声明:因为网络安全原因,我删去了一些必须删去的内容。
http://schema.org/WebPage">Google