0x10000与int/short越界

将0x10000赋给一个int变量,在不同编译器中的结果

1、在VC6.0中:

 1 // 0x10000是否越界int.cpp :
 2 // 看看0x10000是否超了int,
 3 // 理论上1个char是8bit,就是0xFF;1个int是16bit,就是0xFFFF;所以0x10000应该是超的。
 4 
 5 //#include "stdafx.h"
 6 
 7 
 8 int main(int argc, char* argv[])
 9 {
10     int i=0x10000;
11     int ii=(int)0x10000;
12     short s=0x10000;
13     return 0;
14 }

 

通过调试发现,i与ii都是65536,s是0。

对于32位系统下安装的VC6,int是32位,short是16位,s是获取了0x10000的后16bit,得到结果为0x0000,即为0.

2、在IAR中,工程目标MCU为16位的MSP430F5418A:

3、在CCS中,MCU仍为MSP430F5418A:

转载于:https://www.cnblogs.com/wuqi1003/p/4419743.html

解析这段usb枚举 // SUBINF1_DSCR: 0x09, //0 Size of this 0x24, //1 CS_interface 0x01, //2 HEADER subtype 0x00, //3 Revision of class specification-1.0 0x01, //4 0x09, //5 total size of class specific descriptors 0x00, //6 0x01, //7 Number of streaming interfaces 0x01, //8 MIDIStreaming interface 1 belong to this AudioControl interface // INF2_DSCR 0x09, //0 Size of this 0x04, //1 TYPE:interface 0x01, //2 Index of this interface 0x00, //3 Index of this alternate setting 0x02, //4 endpoint number //Have USB in and USB out //0x01, //4 endpoint number //Change for only USB out\no USB IN(2006.12.30) 0x01, //5 audio 0x03, //6 midistreaming 0x00, //7 unused 0x00, //8 Unused // SUBINF2_DSCR: 0x07, //0 Size of this 0x24, //1 CS_interface 0x01, //2 HEADER subtype 0x00, //3 Revision of class specification-1.0 0x01, //4 0x41, //5 total size of class specific descriptors 0x00, //6 // SUBINF3_DSCR: 0x6, 0x24, 0x2, 0x1, 0x1, 0x0, // SUBINF4_DSCR: 0x6, 0x24, 0x2, 0x2, 0x2, 0x0, // SUBINF5_DSCR: 0x09, //0 Size of this 0x24, //1 CS_interface 0x03, //2 HEADER subtype 0x01, //3 Revision of class specification-1.0 0x03, //4 0x01, //5 total size of class specific descriptors 0x02, //6 0x01, //7 Number of streaming interfaces 0x00, //8 MIDIStreaming interface 0 belong to this AudioControl interface // SUBINF6_DSCR: 0x09, //0 Size of this 0x24, //1 CS_interface 0x03, //2 HEADER subtype 0x02, //3 Revision of class specification-1.0 0x04, //4 0x01, //5 total size of class specific descriptors 0x01, //6 0x01, //7 Number of streaming interfaces 0x00, //8 MIDIStreaming interface 1 belong to this AudioControl interface // IN endpoint (mandatory for HID) // Standard int IN endpoint descriptor //EP81_DSCR: 0x09, //0 Size of this descriptor 0x05, //1 Descriptor type: endpoint 0x81, //2 IN endpoint 1 0x02, //3 bulk 0x40, //4 64bytes 0x00, // 0x00, //6 0x00, //7 0x00, //8 // SUBEP81_DSCR: 0x05, 0x25, 0x01, 0x01, 0x03, // OUT endpoint // Standard int OUT endpoint descriptor //EP02_DSCR: 0x09, //0 Size of this descriptor 0x05, //1 Descriptor type: endpoint 0x02, //2 OUT endpoint 2 0x02, //3 bulk 0x40, //4 64bytes //0x10, //16bytes 0x00, // 0x00, //6 0x00, //7 0x00, //8 // SUBEP02_DSCR: 0x05, 0x25, 0x01, 0x01, 0x01
06-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值