set和record数据类型的区别


TTCN-3 supports ordered structured types known as record. The elements of a record type may be any of the basic types or user-defined data types (such as other records, sets or arrays).

 

type record MyRecordType
{
    integer field1,
    MyOtherRecordType field2 optional,
    charstring field3
}

 

TTCN-3 supports unordered structured types known as set. Set types and values are similar to records except that the
ordering of the set fields is not significant.
  
type set MySetType
{
    integer field1,
    charstring field2
}

 

record定义的数据类型,是具有一定顺序的,而使用set定义的数据类型是没有顺序的。

一般情况下,没有本质区别,但是在数据结构赋值的时候,那么set的类型就非常方便了。

record定义的数据类型,就如同类的构造函数一样(在构造函数中,每个成员的初始化都必须和类声明中成员的声明顺序一致)。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值