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 ...
随机推荐
- Win8 安装驱动
从微软的网站上面下载了一些驱动,发现竟然没有Setup或者Install安装程序,囧. 快速查了一下,直接在inf文件右击的菜单里面选择“安装”即可.突然有点out的感觉. 参考:http://dig ...
- C/C++代码静态分析插件 SourceInsight_Scan
sourceinsight-scan 是一款集成在 SourceInsight 中的c/c++代码静态分析插件,集成了cppcheck,coverity,pclint等业界优秀的静态分析工具的优点. ...
- Hadoop使用lzo压缩格式
在hadoop中搭建lzo环境: wget http://www.oberhumer.com/opensource/lzo/download/lzo-2.06.tar.gz export CFLAGS ...
- Codeforces Round #359 (Div. 2)C - Robbers' watch
C. Robbers' watch time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- DB2 SQL性能调优秘笈
SQL优化技巧 1.去除在谓词列上编写的任何标量函数 2.去除在谓词列上编写的任何数学运算 3.SQL语句的Select部分只写必要的列 4.尽可能不用Distinct 5.尽量将In子查询重写为Ex ...
- 拥抱高效、拥抱 Bugtags 之来自用户的声音(四)
小编按:这是一篇 Bugtags 用户来稿,经过一段时间的密集使用,他已然觉得 Bugtags 是 App 开发者的好帮手,感谢解铃 App - 楚琪同学对 Bugtags 的信赖和支持.小编在这里诚 ...
- C#里WinForm开发中如何实现控件随窗体大小的改变而自动适应其改变(转)
在设计可供用户调整大小的窗体时,如何实现该窗体上的控件也应能正确地随窗体的改变而自动调整大小并且能重新定位?此时就要借助控件的.Anchor属性.Anchor属性定义控件的定位点位置.当控件锚定到某个 ...
- Gatling的进阶二
1. 参数化 Gatling可以很方便使用csv文件进行参数化,例如一个用户信息表: /* user_information.csv */ username,password,accoun ...
- oracle常用的数据迁移方法
源地址:http://wenku.baidu.com/link?url=lI6UYpvDs_y8ku6DytEZLl4GSJjQ0GAGPvv8txrbRoQKgqzTCMAfBZI5mn9t-KQk ...
- [ActionScript 3.0] AS3.0 马赛克效果
var bmpd:BitmapData; var matrix:Matrix; var bmp:Bitmap; var size:Number = 5; /** * @author:Frost.Yen ...