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 ...
随机推荐
- Swing多线程
Swing的单线程开发机制 多线程开发,显然要比单线程开发有趣.高效.美妙得多.特别是在Java这种天生支持多线程的语言中,更是如此.可是,Java最重要的组成部分Swing确是单线程的! 并非只有S ...
- Hive架构及Hive On Spark
Hive的所有数据都存在HDFS中. (1)Table:每个表都对应在HDFS中的目录下,数据是经过序列化后存储在该目录中.同时Hive也支持表中的数据存储在其他类型的文件系统中,如NFS或本地文件系 ...
- BestCoder Round #85 hdu5778 abs(素数筛+暴力)
abs 题意: 问题描述 给定一个数x,求正整数y,使得满足以下条件: 1.y-x的绝对值最小 2.y的质因数分解式中每个质因数均恰好出现2次. 输入描述 第一行输入一个整数T 每组数据有一行,一个整 ...
- Linux命令(19)用户权限管理:chown
linux用户权限: Linux/Unix 是多人多工作业系统,所有的档案皆有拥有者.利用 chown 可以将档案的拥有者加以改变. 一般来说,这个指令只有是由系统管理者(root)所使用,一般使用者 ...
- python(14)类,方法,对象,实例
类: 简单来说就是一个函数的集合,在这个集合里面你定义了很多个函数: 方法:其实就是你定义的这些函数. 对象:简单来说就是自身具有多个属性(也可以说是子变量)的变量而已. 在下面的例子中class P ...
- sax,Dom,等解析方式地址 ?
Android中使用SAX对XMl文件进行解析 http://blog.csdn.net/developer_jiangqq/article/details/7197045 使用SAX技术对XML文档 ...
- PopuWindow_1
PopupWindow有点类似于Dialog,相同点在于都是弹出窗口,并且都可以对其进行自定义显示,并且里面的监听组件,进行相应的操作, 但它与Dialog又有很大的区别,PopupWindow只是弹 ...
- js 回车提交表单的实现
我们有时候希望回车键敲在文本框(input element)里来提交表单(form),但有时候又不希望如此.比如搜索行为,希望输入完关键词之后直接按回车键立即提交表单,而有些复杂表单,可能要避免回车键 ...
- CSS如何实现数字分页效果
代码实例如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www ...
- 在Linux环境下安装和配置phpmyadmin
phpmyadmin是一种MySQL的图形化管理工具,该工具允许你在web界面上管理你的mysql数据库,不可谓不方便快捷. 此次安装与配置是在centos 6.4系统下,该系统已部署lnmp环境.关 ...