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.为了使 ...
随机推荐
- window service 2008 解决80端口占用
1.进入cmd使用netstat 命令查看指定端口netstat -ano | findstr :802.如下所示:本地的80端口被进程为4的占用 TCP 0.0.0.0:80 ...
- top 常用
top -c 查看进程 同时 shift +m 内存倒序
- Android开发 ---基本UI组件5:监听下拉选项,动态绑定下拉选项、全选/反选,取多选按钮的值,长按事件,长按删除,适配器的使用,提示查询数据,activity控制多按钮
效果图: 效果描述: 1.当点击 1 按钮后,进入选择城市的页面,会监听到你选中的城市名称:动态为Spinner绑定数据 2.当点击 2 按钮后,进入自动查询数据页面,只要输入首字母,就会动态查找以该 ...
- Collection集合的三种初始化方法
(一) java容器可以分为两大类 1)Collection其中包括List,Set,Queue 2)Map (二) Arrays.asList()方法:接受一个数组或一个逗号分隔的元素列表,并将其转 ...
- 问题 Duplicate entry '0' for key 'PRIMARY'
今天使用了触发器,在一个表中执行增删改操作,然后在另一个表中执行相应的记录时,出现了这个问题 其实这个问题应该算是细节问题,有两种情况: 1.就是在插入数据的时候将id设置为not nul但是在插入数 ...
- Logging常用handlers的使用
一.StreamHandler 流handler——包含在logging模块中的三个handler之一. 能够将日志信息输出到sys.stdout, sys.stderr 或者类文件对象(更确切点,就 ...
- 1.5 pycharm使用
1.5 pycharm使用 前言 在写脚本之前,先要找个顺手的写脚本工具.python是一门解释性编程语言,所以一般把写python的工具叫解释器.写python脚本的工具很多,小编这里就不一一 ...
- 测试那些事儿—软测必备的Linux知识(一)
1.Linux入门须知 1.1文件.目录 linux文件:Linux所有的内容都是以文件形式保存,包括硬件(一切内容皆文件),并且linux不靠扩展名区分文件类型. linux文件有多种基本类型,常见 ...
- 在MySQL中快速的插入大量测试数据
很多时候为了测试数据库设计是否恰当,优化SQL语句,需要在表中插入大量的数据,怎么插入大量的数据就是个问题了. 最开始想到的办法就是写一个程序通过一个很大的循环来不停的插入,比如这样: int i = ...
- js中的Call()和apply()
Call和apply,就是改变函数里面的this指向的方法. xxx.call()或xxx.apply() 特别强调下xxx必须是function,(普通函数,类,构造函数) var obj={ na ...