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. HttpUrlConnection java.net.SocketException: Software caused connection abort: recv failed

    最近做java swing程序在模拟httprequest请求的时候出现了这个错误 java.net.SocketException: Software caused connection abort ...

  2. XML封装与验证消息

    Document document = DocumentHelper.createDocument(); document.setXMLEncoding(ChARSET_UTF_8); Element ...

  3. 单点登录filter根据redis中的key判断是否退出

    package com.ailk.biapp.ci.localization.cntv.filter; import java.io.IOException; import java.util.Has ...

  4. linux中deb怎样安装

    deb是Debian Linux的安装格式,跟Red Hat的rpm非常相似,最基本的安装命令是:dpkg -i file.debdpkg 是Debian Package的简写,是为Debian 专门 ...

  5. cocoaPods 去警告

    pod 'ReactiveCocoa', '~> 2.1', :inhibit_warnings => true

  6. C++中为什么构造函数不能是虚函数,析构函数是虚函数

    一, 什么是虚函数? 简单地说,那些被virtual关键字修饰的成员函数,就是虚函数.虚函数的作用,用专业术语来解释就是实现多态性(Polymorphism),多态性是将接口与实现进行分离:用形象的语 ...

  7. mybatis的增删改查

    一.配置文件方式 mapper.xml: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE ...

  8. java从控制台读取数据的方式

    1. Scanner sc = new Scanner(System.in); String s = sc.readLine(); 2. BufferReader br = new BufferRea ...

  9. textarea文本换行和页面显示换行符

    在textarea里写的文本有换行,但是显示到页面后就不会自动换行,通过对数据分析发现textarea里的换行符是\n\r,然而HTML中的换行为<\br>解决办法有两种: 第一种:把文本 ...

  10. SQL字符串分组聚合(分组后的数据查询后用逗号隔开)

    )) , 'aa') , 'bb') , 'aaa') , 'bbb') , 'ccc') go , , '') from tb group by id