algorithm库里的min,max具体是怎么实现的?

学术版

@[陈启乾](/space/show?uid=57601) 不过为什么我这样的代码在自己的电脑上能运行: ``` #include "bits/stdc++.h" using namespace std; inline increase(int x) { return x+1; } int main() { int p=1; cout<<increase(p); return 0; } ``` 直接inline照样能出结果
by nothingness @ 2018-07-20 23:47:31


我用的dev-cpp 5.1.1
by nothingness @ 2018-07-20 23:48:02


@[nothingness](/space/show?uid=31317) C标准里有说不加类型默认是int 也就是说编译器在编译的时候自动帮你完成了这个类型的定义
by GNAQ @ 2018-07-20 23:50:59


但是不显式声明函数类型出锅我不知道是什么操作
by GNAQ @ 2018-07-20 23:51:30


@[nothingness](/space/show?uid=31317) 上文有误,不是`类型的定义` 是`函数的定义`
by GNAQ @ 2018-07-20 23:52:20


@[FancyDreams](/space/show?uid=21512) 哦懂了,谢谢大佬的耐心讲解
by nothingness @ 2018-07-20 23:56:18


@[nothingness](/space/show?uid=31317) 我大概知道为什么了,等我查查资料
by GNAQ @ 2018-07-21 00:04:15


@[nothingness](/space/show?uid=31317) 你试试本机强制内联会不会CE `inline`->`__attribute__((always_inline))`
by GNAQ @ 2018-07-21 00:11:37


@[FancyDreams](/space/show?uid=21512) ``` [Warning] always_inline function might not be inlinable [-Wattributes] ``` 有个warning,不过能编译通过,并且输出是正确的
by nothingness @ 2018-07-21 00:17:03


可能是我太蒟蒻了,对这些还不够了解。。
by nothingness @ 2018-07-21 00:18:04


上一页 | 下一页