[PIC®/AVR®/dsPIC®产品] XIDE里面怎么定 布尔型 变量 用的是xc16

[复制链接]
1613|5
 楼主| n85gzj 发表于 2014-12-22 10:34 | 显示全部楼层 |阅读模式
XIDE里面怎么定   布尔型   变量   用的是xc16
lcofjp 发表于 2014-12-23 16:05 | 显示全部楼层
#include <stdbool.h>


bool a, b;
a = true;
b = false;
yklstudent 发表于 2014-12-23 19:19 | 显示全部楼层
/*
* Copyright 2010 Microchip Technology Inc, all rights reserved
*
* This file defines the standard boolean types per ISO/IEC 9899:1999
*
*/


#ifndef __bool_true_and_false_are_defined
#define __bool_true_and_false_are_defined

typedef unsigned char bool;

#define true 1
#define false 0
#endif
看看stdbool.h文件内容,自然就知道怎么一回事情了
 楼主| n85gzj 发表于 2015-1-2 16:20 | 显示全部楼层
谢谢哈!
yewuyi 发表于 2015-1-5 12:48 | 显示全部楼层
尽量不要用这种方法,不偏于代码移植。

尽量使用结构联合体的方法。
兰天白云 发表于 2015-1-5 13:24 | 显示全部楼层
如果考虑到移植,最好定义到一个文件里,移植时只改一个文件比较好办
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

6

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部