求助熟悉delphi的兄弟, Pascal 和C++的对应写法!

kmfangxun 2006-09-06 03:26:15
如下 pascal 语句

type
PPacket = ^TPacket;
TPacket = packed record
case Integer of
0: (b0, b1, b2, b3: Byte);
1: (i: Integer);
2: (a: array[0..3] of Byte);
3: (c: array[0..3] of Char);
end;

对应成如下c++,请问是否对?另外上面 Pascal 的case Integer of 是否对应C++的构造函数?

struct TPacket
{
Byte b0, b1, b2, b3;
int i;
Byte a[3];
char c[3];
};

...全文
184 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
kmfangxun 2006-09-06
  • 打赏
  • 举报
回复

多谢多谢各位!看了半天书,不如在这问一下,呵呵!
BlueDeepOcean 2006-09-06
  • 打赏
  • 举报
回复
汗……
BlueDeepOcean 2006-09-06
  • 打赏
  • 举报
回复
typedef union{
struct{
unsigned char b0;
unsigned char b1;
unsigned char b2;
unsigned char b3;
};
int i;
unsigned char a[4];
char c[4];
}TPacket,*PPacket
僵哥 2006-09-06
  • 打赏
  • 举报
回复
其实上后面的struct可以省去

typedef union{
struct{
unsigned char b0;
unsigned char b1;
unsigned char b2;
unsigned char b3;
};
int i;
unsigned char a[4];
char c[4];
}TPacket,*PPacket;
僵哥 2006-09-06
  • 打赏
  • 举报
回复
type
PPacket = ^TPacket;
TPacket = packed record
case Integer of
0: (b0, b1, b2, b3: Byte);
1: (i: Integer);
2: (a: array[0..3] of Byte);
3: (c: array[0..3] of Char);
end;
===================================
typedef union{
struct{
unsigned char b0;
unsigned char b1;
unsigned char b2;
unsigned char b3;
};
struct{
int i;
};
struct{
unsigned char a[4];
};
struct{
char c[4];
};
}TPacket,*PPacket;
原型名称:优质可视化大屏模板图表组件RP文件 软件版本:Axure9(支持10、11) 文件大小:28M 文件页数:16页 原型简介: 【1】数据可视化设计组件包含:常用组件、图标元素、菜单面板、数字字体;常用组件包含:常用按钮、动态公告栏、常用输入框、常用搜索框、时间轴组件、标签列表、下拉选择框、按钮选项组、分页组件、轮播图组件、视频播放器、表格组件、日期天气组件等;图标元素包含近百个图标元素可用于可视化设计使用;菜单面板包含多套大屏中间页菜单组合案例;数字字体包含多套不同风格字体的数字组件。 【2】数据可视化图表组件包含:常用图表、美化图表、图表动效、图表尺寸、数值展示、排行展示、地图组件、图表色板;常用图表包含:柱状图、条形图、圆环图、折线图、面积图、堆叠图等;美化图表包含各种立体图表、渐变图表如立体柱状图、立体圆柱图、渐变柱状图、渐变曲线图、渐变面积图、对比图等;动效图表提供动态交互案例;图表尺寸包含大小中各类尺寸图表案例;数值展示为可视化设计提供更多数值的设计案例;排行展示包含近20中排行列表组件的案例;如果有地图设计需要可以使用到地图组件;图表色板提供了可视化设计中专业的单色/渐变色组件。

13,873

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧