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 ...
随机推荐
- Skip StyleCop Warnings.
[SuppressMessage("Microsoft.StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMust ...
- CF 15/09/23
CF580A 给出一个数列,求最长不下降子序列(连续) 直接DP,O(n) CF580B 主人公有n个朋友,每一个朋友有2个属性:m,sat 现在他想邀请部分朋友,邀请的人满足MAX_M-MIN_M& ...
- redis使用日志(二) 数据存储到redis
一段简短的代码,来展示如何把爬取内容写到redis里面: #! /usr/bin/env python # -*- coding=utf-8 -*- import requests import js ...
- 【JavaScript】微信适配的Head
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <me ...
- MyBatis返回主键
网上给的例子都很简单 , 只要用useGeneratedKey就行了. @Insert({ "INSERT INTO money_record_increasement (id, creat ...
- make[1]: *** [pcrecpp.lo] 错误 1
在安装:pcre-8.30 时,报如下错误: [root@localhost pcre-8.30]# make && make installmake all-ammake[1]: ...
- codeblocks调试快捷键说明
使用codeblocks避免不了快捷键: 在调试程序的时候: 首先在view->toolbar->debugger调出来:快捷方式可以自己看 RUN to Cursor :F4 单步调试 ...
- centos7 下安装MongoDB
查看MongoDB的最新版官方下载地址: https://www.mongodb.com/download-center#community 使用wget命令下载安装包 wget https://fa ...
- 大容量导入和导出 XML 文档的示例
示例表 若要测试示例 A,必须创建示例表 T. USE tempdb CREATE TABLE T (IntCol int, XmlCol xml); GO 示例数据文件 在运行示例 A 之前,必 ...
- ArcGIS Engine 下投影坐标和经纬度坐标的相互转换
ArcGIS Engine 下投影坐标和经纬度坐标的相互转换 投影转经纬度 ); pPoint.Project(pSRF.CreateGeographicCoordinateSystem((int)e ...