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 )的更多相关文章

  1. C++如何使用宏定义来简化代码性能测试 | cpp macro like function to implement a performance profiler

    本文首发于个人博客https://kezunlin.me/post/65dc693d/,欢迎阅读最新内容! cpp macro like function to implement a perform ...

  2. [转] iOS ABI Function Call Guide

    source: apple ARMv6 Function Calling Conventions When functions (routines) call other functions (sub ...

  3. 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 ...

  4. function multi-versioning in GCC

    https://lwn.net/Articles/691932/ https://gcc.gnu.org/wiki/FunctionMultiVersioning why multi-versioni ...

  5. C++对象模型——指向Member Function的指针 (Pointer-to-Member Functions)(第四章)

    4.4 指向Member Function的指针 (Pointer-to-Member Functions) 取一个nonstatic data member的地址,得到的结果是该member在 cl ...

  6. 剖析std::function接口与实现

    目录 前言 一.std::function的原理与接口 1.1 std::function是函数包装器 1.2 C++注重运行时效率 1.3 用函数指针实现多态 1.4 std::function的接 ...

  7. boost function bind ref

    boost::function to encapsulate function pointers. 1. function #include <boost/function.hpp> #i ...

  8. Function Overloading in C++

    In C++, following function declarations cannot be overloaded. (1)Function declarations that differ o ...

  9. [转载] what's goole mock

    原文: https://code.google.com/p/googlemock/wiki/V1_7_ForDummies 地址被墙了, 看起来费劲, 转载一份 Google C++ Mocking ...

随机推荐

  1. suibi 117

    -Djava.net.preferIPv4Stack=true re.findall(r"^(\d+)" , content) content = content.replace( ...

  2. ZOJ 3606 Lazy Salesgirl 浙江省第九届省赛

    Lazy Salesgirl Time Limit: 5 Seconds      Memory Limit: 65536 KB Kochiya Sanae is a lazy girl who ma ...

  3. ScrollView--嵌套GridView的解决办法

    前些日子在开发中用到了需要ScrollView嵌套GridView的情况,由于这两款控件都自带滚动条,当他们碰到一起的时候便会出问题,即GridView会显示不全. 解决办法,自定义一个GridVie ...

  4. centos下的一些命令

    1.查看版本 cat /etc/redhat-release 2.安装VIM yum -y install vim-enhanced 3.升级系统 yum -y update 4.把 vi 替换为 v ...

  5. JavaScript笔记之数组 keyword(存储和释放&堆栈 & 按值 引用)

    1.数组创建及初始化 var obj=new Array(); var arr=[]; 可以延伸为长度一定的,字面量定义数组 2.堆栈 按值传递 引用类型 数组是引用类型,不是值传递, 栈:系桶自动分 ...

  6. bootstrap-按钮样式

    <div class="container"> <!-- 按钮的背景色 --> <div class="row"> < ...

  7. linux 好玩的命令

    发现一个linux好玩的命令,随机显示名言警句和诗词:fortune 和 fortune-zh (中文) cowsay: 小动物说话- ________________________________ ...

  8. C#里WinForm开发中如何实现控件随窗体大小的改变而自动适应其改变(转)

    在设计可供用户调整大小的窗体时,如何实现该窗体上的控件也应能正确地随窗体的改变而自动调整大小并且能重新定位?此时就要借助控件的.Anchor属性.Anchor属性定义控件的定位点位置.当控件锚定到某个 ...

  9. Ubuntu下删除配置错误或者失败的安装包

    aptitude purge $(dpkg -l|grep ^rc|awk '{ print $2 }') 解释:dpkg -l 列出系统中所有安装的软件,如果是已经删除的软件(有残存的配置文件),那 ...

  10. C++学习11 类和new、delete操作符 类与const关键字

    如果你是Java.C#.PHP程序员,那么会对 new 非常熟悉,在这些编程语言中,只能通过 new 来创建对象. 在C++中,你可以像定义变量一样来创建对象,如: Student stu; //对象 ...