为什么要使用 clang 和 gcc,当您想要使用“int32_t”或“memcpy”时,您的包含是不同的
Why use clang and gcc, your include is different when you want use `int32_t` or `memcpy`?
为什么当你想使用int32_t
或memcpy
时,gcc48和clang之间有不同的包含?
GCC 时,在包含 <iostream>
之后,还应包含用于使用 int32t
和 memcopy
的<stdint.h>
和<string.h>
使用clang时,你只需要包含<iostream>
,就可以免费使用int32t
和memcopy
,stdint.h和string.h自动包含。
为什么?我可以运行 clang 作为 gcc 行为吗?
我使用Mac OS。
可能是因为 clang 的标准库恰好包含 <stdint.h>
和 <string.h>
已经出于自己的私人原因<iostream>
; 这是不能保证的,而且,正如你所看到的,你的gcc
的标准库不是这样工作的。
不要依赖这种行为;无论这些巧合如何,始终包含所需的文件。
相关文章:
- 具有相同特征的两个对象是否只在内存中存储一次?无论定义它们的函数是什么,都是不同的
- 将一个向量映射到不同的对,即使向量映射到每对时是不同的?
- int* 和 int** 是不同的类型吗?C++
- 是std::memcpy在不同的可复制类型之间的未定义行为
- C++问题,我的两个源代码应该具有相同的输出,但它们是不同的
- 通过 char* 缓冲区读取 int 的行为是不同的,无论是正数还是负数
- OpenSSL:读取EC密钥,然后再次写入,这是不同的
- "const_iterator"真的需要与"迭代器"是不同的类吗?
- C++ 如果 Printf 位于函数中,则返回是不同的
- 在C 字符串中,为什么在最后一个字符之后,通过索引和()访问索引时行为是不同的
- 我正在比较两个具有相同值的变量,但它说它们是不同的
- 是一个被认为是不同类型的班级内部的正向声明
- 对于不同的消息,OpenSSL 签名长度是不同的
- 结果是不同的;C++ 中的 recv(sock,buf,sizeof(buf),0) 和 strlen(buf)
- 为什么推导出的乐趣(T t)和乐趣(T && t)的类型在C++中是不同的?
- 为什么C++编译器不优化对结构数据成员的读取和写入,而不是不同的局部变量?
- 使用模板在核心类型不同的不同项目中使用通用代码,这些项目的核心类型在 c++ 中是不同的
- python 和 c++ 的结果对于嵌套的 for 语句是不同的
- PCL中的这些增强指针初始化是不同的
- 为什么要使用 clang 和 gcc,当您想要使用“int32_t”或“memcpy”时,您的包含是不同的