各种 C++ main() 签名及其效率

various C++ main() signatures and their efficiency

最近我在一个竞争性编程网站上看到了下面给出的代码,

   #include<bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#define pb push_back
#define d double
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

signed main()
{ return 0; //Omitted the rest of the code
}
[Full Code][1]

https://www.codechef.com/viewsolution/22121098

我想知道这段代码与 int main() 的常规 C++ 代码在效率和 CPU 速度方面的性能有什么区别,问题集合通常很大。

signed main() 等同于 int main(),除非 - 就像在示例中一样 - 你有一个将 int 定义为 long long 的宏。 main() 到 return 一个 int 但宏 #define int long long 意味着在这种情况下使用语法 int main() 不会编译时出现错误,指出 ::main 必须 return int。因此,signed main()

signedsigned int 也是 int.

所以signed main()int main().

作者要么是想显得聪明,要么是想聪明却失败了。