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 ...
随机推荐
- yarn的调度策略
一. yarn的资源分配模型 无论先进先出调度器,容量调度器,还是公平调度器,他们的核心:资源分配模型是一样的. 调度器维护着多个队列的信息,用户可以向任意一个或多个队列提交job.每次NodeMan ...
- (C/C++) Interview in English - Points.
Q: What is a dangling pointer? A: A dangling pointer arises when you use the address of an object af ...
- jetty-run运行报错的原因
- kafka_2.11-0.8.2.2的搭建
一.下载官网的压缩包~ 修改conf/server.properties host.name=10.10.224.12 (修改为主机ip,不然服务器返回给客户端的是主机的hostname,客户端并不 ...
- DBA_Oracle数据库运维监控(案例)
2014-07-27 Created By BaoXinjian
- [复变函数]第10堂课 3.2 Cauchy 积分定理
0. 引言 (1) $\dps{\int_{|z-a|=\rho}\frac{1}{z-a}\rd z=2\pi i\neq 0}$: 有奇点 (在 $|z|>0$: 二连通区域内解析), 周线 ...
- viewpage广告条的制作
package com.itheima27.viewpagerdemo; import java.util.ArrayList; import java.util.List; import andro ...
- Ubuntu 12.04.2搭建nfs服务器
1.安装nfs 服务器(192.168.0.1) apt-get install nfs-kernel-server 2.修改nfs配置文件: vim /etc/exports 在exports文件中 ...
- Java实现单向链表的增删改查
class List<T> { private class Node { private T data; private Node next; private Node(T data) { ...
- spring错误<context:property-placeholder>:Could not resolve placeholder XXX in string value XXX
spring同时集成redis和mongodb时遇到多个资源文件加载的问题 这两天平台中集成redis和mongodb遇到一个问题 单独集成redis和单独集成mongodb时都可以正常启动程序,但是 ...