c++ - iostream 或 C++ 中的其他地方是否有称为时间的东西?

标签 c++ time iostream standard-library c++-standard-library

代码编译没有错误,但是 time 没有声明。

幸运的是,我将名称更改为mtime,错误已经消失。但错误的本质是什么?什么是时间

这个程序的输出是1。我想知道文件 iostream 或某处是否有任何名为 time 的东西。

#include <iostream>
int main()
{
    std::cout << time << std::endl;
    return 0;
}

最佳答案

是一个time_t time(time_t*)的地址充当您的<iostream>实现包括 time.h header 。地址will never be NULL并且可以隐式转换为 bool 值,因此是 1 的结果.您可能在 Linux 上使用 g++。

关于c++ - iostream 或 C++ 中的其他地方是否有称为时间的东西?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46602726/

相关文章:

c++ - 字符串转wstring,编码问题

c++ - c++中字符串转整数问题

python - 在一段时间后终止 Python 脚本

c++ - 读入非数值时的 cin 无限循环

c++ - 从 C++ 输出中删除逗号

C++ 为什么这些构造函数调用中有 3 个有效,而一个无效?

c++ - 无法在 Windows XP 上编译 rsa.h

time - 获取有关 ntp 调整的通知

javascript - Javascript 中 unshift() 与 push() 的时间复杂度

c++ - 为什么 std::num_put 通过非 const 引用获取 ios_base 参数?