Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » variable definition(variable definition)
variable definition [message #1803407] Thu, 28 February 2019 08:39 Go to next message
le tian is currently offline le tianFriend
Messages: 16
Registered: October 2018
Junior Member
In TTCN-3, can static variables and global variables be defined as C? What should I do if I need to define data in this way?
Re: variable definition [message #1803413 is a reply to message #1803407] Thu, 28 February 2019 09:47 Go to previous messageGo to next message
Jeno Attila Balasko is currently offline Jeno Attila BalaskoFriend
Messages: 80
Registered: September 2013
Location: Budapest, Hungary

in TTCN-3 there is no such as global variable but it has much more scope than C has.

Static global variable and static function variable do'nt exist in TTCN-3 but component variables are similar to class member variables in C++ and Java.

Not every scope has variable, e.g module level variables do not exist.
Let me refer to the paragraph 5.2.0 first part of the TTCN-3 standards, ETSI ES 201 873-1,
TTCN-3 provides nine basic units of scope:
a) module definitions part;
b) control part of a module;
c) component types;
d) functions;
e) altsteps;
f) test cases;
g) statement blocks;
h) templates;
i) user defined named types.

There is a scope hierarcy discussed in 5.2.0.

I would suggest to read the standard mentioned above.
I would also suggest the ttcn3-courses, especially the first,

Best regards
Re: variable definition [message #1803415 is a reply to message #1803413] Thu, 28 February 2019 09:58 Go to previous message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Le Tian,

the lack of global variables is intentional, and has the following philosophy:

components are being used to simulate separate nodes in TTCN-3 ; these nodes can be physically distinct, located in different geographical positions etc.
in the physical reality they are forced to communicate among themselves over physical channels that present an amount of latency /delay.

Simulations are forced, in lack of global variables, to use connections (e.g. internal ports) between components that are the equivalent of the above physical channels.
If global variables would exist, components could communicate with each other using such shared variables, which would lead to an unrealistic simulation.

So lack of global variables is more a feature that enforces a discipline and a way of thinking than a missing language element.

Best regards

Previous Topic:patch: Print symbolic version in "compiler -v"
Next Topic:Data operation
Goto Forum:

Current Time: Sun Jul 25 02:52:20 GMT 2021

Powered by FUDForum. Page generated in 0.02172 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top