当前位置:网站首页>spicy (1) basic definition
spicy (1) basic definition
2022-07-30 03:43:00 【a tobey】
unit
spicy parses data units through the unit type, which is similar to the well-known struct or record type.It defines a series of sequential fields, each of which has a name and a type, and stores the corresponding value at runtime.Units can be instantiated, assigned values to various fields, and those field values can be retrieved.
module Test;public type Foo = unit {# define a 32-bit integerversion: uint32 &default=56; # You can add the &default attribute to add a default value, otherwise the default value will not be set};# instantiate as fglobal f:Foo;# You can assign a value to override the default value of 56# f.version=60;print f; # Note that if the field inside is not assigned a value, the default value will not be read even if there is a default value.shows not setprint "version is %s" % f.version; # Note that when accessing the field, if there is no assignment, but there is a default value, the default value will be read

A unit is the starting point or entry for parsing data.If you want to make the unit outside the current module (that is, other files want to use the unit defined by the file), you need to declare it as public, and you can only write it for internal access.
By default, spicy is in network byte order.Can
边栏推荐
- 小程序毕设作品之微信二手交易小程序毕业设计成品(2)小程序功能
- Public chains challenging the "Impossible Triangle"
- WPF 学习笔记《WPF布局基础》
- 一直空、一直爽,继续抄顶告捷!
- 对均匀采样信号进行重采样
- Drools(7):WorkBench
- Is the snowflake the same question?
- 答对这3个面试问题,薪资直涨20K
- Software testing interview questions and answer analysis, the strongest version in 2022
- 小程序毕设作品之微信二手交易小程序毕业设计成品(1)开发概要
猜你喜欢

Open address method hash implementation - linear detection method

One book 1922 - table tennis

HCIP experiment (05) OSPF comprehensive experiment

HCIP OSPF

What is the difference between mission, vision and values?

Nacos 安装与部署

OA项目之待开会议&历史会议&所有会议

SQL Server中如何在date类型中提取年、月、日数据

SDL player in action

Three years of experience will only be a little bit (functional testing), and you may not even be able to find a job after resigning.
随机推荐
HCIP experiment (05) OSPF comprehensive experiment
NLP Natural Language Processing (2)
Solve The problem of Google browser cross-domain has had been blocked by CORS policy: The request The client is not a secure context and The resou
3.nodejs--modularization
Hystrix service circuit breaker
WPF递归获取窗体中指定控件类型列表
路由过滤器
The most important transport layer
Starlight does not ask passers-by!The young lady on the Wuhan campus successfully switched to software testing in three months and received a salary of 9k+13!
Nacos Configuration Center
vscode 调试和远程
nSoftware.PowerShell.Server.2020
【GPU并行计算】利用OpenCL&OpenCLUtilty进行GPU并行计算
Awesome, Tencent technical experts handed Redis technical notes, and the download volume has exceeded 30W
BindingExpression path error: ‘selectMenusList‘ property not found on ‘object‘ ‘‘ViewModel“
联邦学习综述(二)——联邦学习的分类、框架及未来研究方向
curl命令获取外网ip
淘宝H5接口获取app数据6.0格式
如何有效进行回顾会议(上)?
Introduction to management for technical people 1: What is management