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.为了使 ...
随机推荐
- java项目改为web项目
1.进入项目目录,可看到.project文件,打开. 2.找到<natures...</natures代码段. 3.在第2步的代码段中加入如下标签内容并保存: <nature& ...
- C#获取程序运行时间
需要用到System.Diagnostics名称空间中的Stopwatch类! Stopwatch类其中有一个属性ElapsedMilliseconds.该属性是获取当前运行时间,以毫秒为单位! 其中 ...
- Nginx 单个进程允许的最大连接数
(1) 控制 Nginx 单个进程允许的最大连接数的参数为 worker_connections ,这个参数要根据服务器性能和内存使用量来调整 (2) 进程的最大连接数受 Linux 系统进程的最大打 ...
- 解决android 9上无法使用http协议
用户反应本来好用的app,突然无法访问服务器,不能正常用了,拿到手机,从头检查权限,重新安装都不能解决,网络是正常的,怎么就不能访问网络了呢?所有想到的办法都用了而不能解决,最后想起看一下androi ...
- openFileDialog的使用
这两天应用了一下openFileDialog,做的是上传的功能,在打开页面的时候进行的一系列操作虽说远远没有asp.net的上传控件好使,但是学习起来也是蛮还用的,下面是一个简单的应用 //点击浏览按 ...
- ItelliJ idea tomcat 配置
用ItelliJ idea 开发javaWeb. 1. Idea 安装Tomcat 打开Idea,选择设置,并在设置中左边框中选择 Application Servers 点击中间空白框上面的 ’+‘ ...
- 【转载】 强化学习(九)Deep Q-Learning进阶之Nature DQN
原文地址: https://www.cnblogs.com/pinard/p/9756075.html ------------------------------------------------ ...
- Cortex-M3 跳转到指定bin执行
跳转前指定sp和msp: #if defined(__GNUC__) __attribute__(( naked )) static void set_sp(unsigned long addr) { ...
- https原理及其中所包含的对称加密、非对称加密、数字证书、数字签名
声明:本文章已授权公众号Hollis转载,如需转载请标明转载自https://www.cnblogs.com/wutianqi/p/10654245.html(安静的boy) 一.为什么要使用http ...
- linux的基本操作2
/dev/ha[a-d] IDE硬盘(过时了)/dev/sd[a-p] U盘,scsi,sata,ssd硬盘(流行)/dev/cdrom 光盘 CD-ROM/dev/mouse 鼠标 fdisk ...