The difference between macro and function I/Ofunction comparision(from c and pointer )
macro is typeless and execute faster than funtion ,becaus of the overhead of calling and returnning of function,but macro will increase the size of program due to many time's substitution,as well as the side effect of macro may cause unexpected results,to avoid this ,you'd better make the arguments bracketed as possible as you can,on the contrary ,the result of function is more predicted.
macro :definitine commom argument ,little funtion such as MAX,MIN,
function :specific module or operation
getchar: ch=getchar(); fgetc()/getc()
putchar : putchar(ch); fputc()/putc()
gets: gets(*str);{\n terminate, not include \n} fgets(char *str,int n ,FILE *stream){\n terminate, include \n}only read in n-1 char the last is filled with null
puts: puts(*str);{ add \n} fputs(char *str,int n ,FILE *stream){not add \n}all of this function operating in line return a char *of target
scanf: fscanf(FILE *stream,char *format,[argument]) sscanf( string str, string fmt, mixed var1, mixed var2 ... );
printf: fprintf(FILE *stream,char *format,[argument]) sprintf( char *buffer, const char *format [, argument] … );
The difference between macro and function I/Ofunction comparision(from c and pointer )的更多相关文章
- C++如何使用宏定义来简化代码性能测试 | cpp macro like function to implement a performance profiler
本文首发于个人博客https://kezunlin.me/post/65dc693d/,欢迎阅读最新内容! cpp macro like function to implement a perform ...
- [转] iOS ABI Function Call Guide
source: apple ARMv6 Function Calling Conventions When functions (routines) call other functions (sub ...
- How to create DB2 user function easily by DB Query Analyzer 6.03
How to create DB2user function easily by DB Query Analyzer 6.03 Ma Genfeng (Guangdong Unitoll Servic ...
- function multi-versioning in GCC
https://lwn.net/Articles/691932/ https://gcc.gnu.org/wiki/FunctionMultiVersioning why multi-versioni ...
- C++对象模型——指向Member Function的指针 (Pointer-to-Member Functions)(第四章)
4.4 指向Member Function的指针 (Pointer-to-Member Functions) 取一个nonstatic data member的地址,得到的结果是该member在 cl ...
- 剖析std::function接口与实现
目录 前言 一.std::function的原理与接口 1.1 std::function是函数包装器 1.2 C++注重运行时效率 1.3 用函数指针实现多态 1.4 std::function的接 ...
- boost function bind ref
boost::function to encapsulate function pointers. 1. function #include <boost/function.hpp> #i ...
- Function Overloading in C++
In C++, following function declarations cannot be overloaded. (1)Function declarations that differ o ...
- [转载] what's goole mock
原文: https://code.google.com/p/googlemock/wiki/V1_7_ForDummies 地址被墙了, 看起来费劲, 转载一份 Google C++ Mocking ...
随机推荐
- Freescle cortex-A9(完善中...)
关键词:cortex-A9 , udoo ,mars board ; (内容参考,飞思卡尔官方网站,如有问题请联系本人) i.MX 6系列处理器推出了业界首个具有真正扩展性的多核平台,包括基于ARM® ...
- Builder模式(建造者模式)
在设计模式中对Builder模式的定义是用于构建复杂对象的一种模式,所构建的对象往往需要多步初始化或赋值才能完成.那么,在实际的开发过程中,我们哪些地方适合用到Builder模式呢?其中使用Build ...
- Hbase与hive整合
//hive与hbase整合create table lectrure.hbase_lecture10(sname string, score int) stored by 'org.apache.h ...
- PLSQL_闪回操作1_Flashback Query
2014-07-02 Created By BaoXinjian
- NeHe OpenGL教程 第二十课:蒙板
转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...
- 用widthStep的方法来增加某范围的像素----与imageROI对比
//用widthStep的方法来增加某范围的像素 //作者:sandy //时间:2015-10-5 #include <cv.h> #include <highgui.h> ...
- 资源文件assets和 res下面raw文件的使用不同点
在建立项目中一般会默认建立assets文件,当然我们还可以在res文件下面建立raw文件夹,这里面都可以存放一些图片,音频或者文本信息,可以供我们在程序当中进行使用,不过他们两个也有不同点: asse ...
- MODBUS-RTU学习
一 RTU比ASCII传输密度高.参数格式:起始位+8BITS数据位+校验位+停止位. 1.1校验默认为偶校验,建议为无校验,测试要多1个停止位(即停止位为2位) 1.2发送顺序为从左到右LSB-&g ...
- ORM框架:EF与NHibernate了解
在.Net Framework SP1微软包含一个实体框架(Entity Framework),此框架可以理解成微软的一个ORM产品.用于支持开发人员通过对概念性应用程序模型编程(而不是直接对关系存储 ...
- Decorator装饰模式
动态地给一个对象增加一些额外的职责.就增加功能而言,Decorator模式比生成子类更为灵活. ——<设计模式>GoF 作用:在不影响其他对象的情况下,以动态.透明的方式给单个对象添加职责 ...