C++ #define #if #ifndef 宏指令
不会用就直接复制粘贴
#define CURSOR(top,bottom) (((top)<<8)|(bottom))
#define mul(x1,x2) (x1*x2)
#define WIDTH 8
#define LENGTH (WIDTH+10) /**
*
* check is c++ compiler
*/
#if !defined(__cplusplus)
#error c++ compiler requires
#endif #if defined(CLANG)//if defined CLANG use below code
void compiler()
{
std::cout<<"use clang"<<std::endl;
}
#elif defined(GUNC)
void compiler()
{
std::cout<<"use gunc++"<<std::endl;
}
#else
void compiler()
{
std::cout<<"unknown compiler"<<std::endl;
}
#endif #define DLEVEL 5 #if DLEVEL > 5
#define SIGNAL 1
#if STACKUSE == 1
#define STACK 200
#else
#define STACK 100
#endif
#else
#define SIGNAL 0
#if STACKUSE == 1
#define LEVEL 1
#define STACK 100
#else
#define STACK 50
#endif
#endif
#if LEVEL == 0
#define STACK 0
#elif DELEVEL == 1
#define STACK 100
#elif DLEVEL > 5
display(debugptr);
#else
#define STACK 200
#endif /* EXAMPLE.H - Example header file*/
#if !defined(EXAMPLE_H)
#define EXAMPLE_H
class Example
{ };
#endif /**
*
*Visual Studio 2017 version 15.3 and later,检查库头文件是否包含
*/
#
#ifdef _has_include
# if _has_include(<filesystem>)
# inculde <filesystem>
# define have_filesystem
# elif _has_include(<experimental/filesystem>)
# include <experimental/filesystem>
# define have_filesystem
# define experimental_filesystem
# else
# define have_filesystem
# endif
#endif #ifndef test
#define final
#endif //has no effect
# //stringizing 操作符转换宏指令参数成字符串字面量.
//比如下面这句 "This: \" prints an escaped double quote"
#define stringer(x) printf(#x "\n") #define F int
#define B def
#define FB(arg) #arg
#define FB1(arg) FB(arg)
C++ #define #if #ifndef 宏指令的更多相关文章
- C/C++预处理指令#define,#ifdef,#ifndef,#endif… (转)
本文转自博文C/C++预处理指令#define,#ifdef,#ifndef,#endif….这篇博文写得特别好,特转载. 本文主要记录了C/C++预处理指令,常见的预处理指令如下: #空指令,无任何 ...
- C/C++预处理指令#define,#ifdef,#ifndef,#endif…
2016年12月29日更新: 今天查看以前文件的时候, 突然发现了#error 这个预处理指令.然后回想一下工作, 发现这个指令使用场景还是很多的.比如: 一个项目的模块儿之多,源文件之大,代码之多, ...
- C++ #if #endif #define #ifdef #ifndef #if defined #if !defined详解 (转)
(源)http://blog.csdn.net/sky1203850702/article/details/42024673 首先,让我们先从头文件开始,在很多头文件里,我们会看到这样的语句 #ifn ...
- c语言中的#ifdef和#ifndef
#include "stdio.h"#include "conio.h"#define MAX#define MAXIMUM(x,y) (x>y)?x:y ...
- 2014.3.11-C语言学习小结
文件操作: 知识点: 持久化 1.文本文件的读写 2.二进制文件的读写 3.缓冲文件系统 1.打开文件 2.读写文件 3.保存 4.关闭文件 ============================= ...
- dll导入导出宏定义,出现“不允许 dllimport 函数 的定义”的问题分析
建立dll项目后,在头文件中,定义API宏 #ifndef API_S_H #define API_S_H ...... #ifndef DLL_S_20160424 #define API _dec ...
- SQLite源程序分析之sqlite3.c
/****************************************************************************** ** This file is an a ...
- c/c++头文件_string
string, cstring, string.h 一.string头文件 主要包含一些字符串转换的函数 // sto* NARROW CONVERSIONS// sto* WIDE CONVERSI ...
- 【VC++技术杂谈007】使用GDI+进行图片格式转换
本文主要介绍如何使用GDI+对图片进行格式转换,可以转换的图片格式为bmp.jpg.png. 1.加载GDI+库 GDI+是GDI图形库的一个增强版本,提供了一系列Visual C++ API.为了使 ...
随机推荐
- VMware与Centos系统安装、重置root密码
VMware与Centos系统安装 今日任务 .Linux发行版的选择 .vmware创建一个虚拟机(centos) .安装配置centos7 .xshell配置连接虚拟机(centos) 选择性 ...
- 第一章02: 常用的DOS命令
win+R=命令框 +输入CMD ,进入命令行.或者控制台 DOS命令如下: cd命令 1. CD.. = 返回上级目录 2. cd\ = 直接退到根目录 3.cd (地址)= 直接到指定文件 切盘符 ...
- python变量进阶(可变不可变,局部变量和全局变量)
变量进阶(理解) 目标 变量的引用 可变和不可变类型 局部变量和全局变量 01. 变量的引用 变量 和 数据 都是保存在 内存 中的 在 Python 中 函数 的 参数传递 以及 返回值 都是靠 引 ...
- JS实现大整数乘法(性能优化、正负整数)
本方法的思路为: 一:检查了输入的合法性(非空,无非法字符) 二:检查输入是否可以进行简单计算(一个数为 0,1,+1,-1) 三:去掉输入最前面可能有的正负符号,并判断输出的正负 四:将输入的值分成 ...
- locate语法
1.命令格式:locate [参数] [文件] 2.命令功能:locate命令可以在搜寻数据库时快速找到档案,数据库由updatedb程序来更新,updatedb是由cron daemon周期性建立的 ...
- centos7.3 64位 安装git
1.安装编译git时需要的包 # yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel # yum ins ...
- java-Collection集合、List集合、Vector集合和迭代器Iterator、ListIterator的使用
1.对象数组的概述和使用 * A:案例演示 * 需求:我有5个学生,请把这个5个学生的信息存储到数组中,并遍历数组,获取得到每一个学生信息. * Student[] arr = new Student ...
- python trie
Trie 库 https://github.com/pytries/marisa-trie/blob/master/docs/tutorial.rst http://marisa-trie.readt ...
- 导入导出Oracle
- 快速部署私人git服务--基于docker化Gogs
Gogs 一款极易搭建的自助 Git 服务. 环境 Linux系统 docker 获取gogs镜像,并运行, docker run -it --: -p : -v /var/gogs:/data go ...