编译器总是在cpp中编译未使用的函数
Compiler always compiles unused function when in cpp
即使我不使用这个函数,如果函数是在cpp中实现的,它也总是使用4字节的ram(因为attachInterrupt())。如果我让它在.h中内联,它就不会编译任何
.h
// attach the interrupt function
void IRLbegin(const uint8_t interrupt);
.cpp
void IRLbegin(const uint8_t interrupt){
// attach the function that decodes the signals
attachInterrupt(interrupt, IRLinterrupt, CHANGE);
}
我该怎么办?把所有东西都写在.h中,我认为这不是一种好的编码风格。由于Arduino环境的原因,我无法更改优化设置。
一个简单调用另一个函数的函数在头中进行了精细内联。试试IDE的1.5.8版本,因为它有一个更新的编译器,通常会在我找到的.CPP中内联小函数。
相关文章:
- 普通环路未使用gcc 4.8.5自动矢量化
- 在更改for循环的第三部分后,未使用for循环结果
- 使用typeid警告未使用的变量
- C++删除未使用的类属性会导致 std::logic_error
- make 命令如何避免重新编译未更改的源文件?
- 我无法编译谷歌测试,告诉链接器输入未使用(macOS)
- 在编译期间包含未使用的代码
- 编译错误:"error_category"未使用 g++ 6.3.0 命名类型"
- 用于 JUnit 测试的本机代码未使用 'nar-maven-plugin' 编译
- 源文件未使用最新版本的Dev C 和OpenCV 3.x版本编译
- gcc 什么时候编译未使用的模板代码?
- 使用 gcc 编译和使用 clang 编译代码时未定义的引用
- clang:警告:编译期间未使用的参数:"-stdlib=libc++"
- 编译并使用Live555 Libs -Windows和Mingw(未解决的引用)
- 编译时检查函数是否使用/未使用 c++
- 值的赋值运算符未使用显式复制构造函数进行编译
- 未使用调试器标志编译的代码出现分段错误
- 编译器总是在cpp中编译未使用的函数
- C++:编译未使用的类
- 为什么Visual C++编译器将未使用的类编译为可执行文件