Hi,
the only contraint that is given in ETSI ES 201 873-1 V2.2.1 is the follo= wing
statement in the BNF:
STATIC SEMANTICS - SingleConstExpression shall not contain Variables or M= odule
parameters and shall resolve to a constant Value at compile time
From that point of view, the ETSI usage is correct (and also the rnd() mi= ght
be possible).
Best regards,
Stephan
Vesa-Matti Puro wrote:
> Hello TTCN-3 users:
>
> In the ETSI SIP test suite of version 2004-Nov-26 there is the
>following lines in SIP_TypesAndConf.ttcn:
>
> // %d09 ; US-ASCII HT, horizontal tab character
> const charstring TAB := oct2str('09'O);
>
> // %d13 ; US-ASCII CR, carriage return character
> const charstring CR := oct2str('0D'O);
>
> // %d10 ; US-ASCII LF, line feed character
> const charstring LF := oct2str('0A'O);
>
> It clearly indicates that at least ETSI is using in this case
>predefined conversion functions of TTCN-3 to initialize charstring
>consts. So functions can be used to inialize consts.
>
> I guess at least some TTCN-3 predefined functions can be used with
>consts. I guess there is not clear definition which functions can be
>used and which not.
>
> Best regards,
> Vesa-Matti
>
> ETHGRY wrote:
>
>>Hi,
>>
>>could, but this is would be an EXTENSION to
>
> the standard (therefore not a requirement toward tools). Hence
>writing a code with "const float c := rnd(0.1);" may run on one tool
>and may not run on another tool. I personally doubt if any tool
>supports such an extension because as you wrote this would be bad
>style without any real benefit.
>
>>Gyorgy
>>
>>
>>
>>>
Original Message
>>>From: active_ttcn3 : mts stf133 ttcn version 3 - active members
>>>only [
This email address is being protected from spambots. You need JavaScript enabled to view it.]
>>>Sent: Wednesday, May 25, 2005 10:27 AM
>>>To:
This email address is being protected from spambots. You need JavaScript enabled to view it.
>>>Subject: Re: rnd() as a constant expression
>>>
>>>
>>>Hi,
>>>
>>>Well, yes, except that the tool could be smart enough to figure out
>>>return values of certain predefined functions already at translation
>>>time, much like it could evaluate values of constant expressions at
>>>that time.
>>>
>>>While personally I don't think that the example with rnd() is a good
>>>style for use in constants, I would expect that certain tools would
>>>allow that and certain tools would not, hence either save yourself
>>
>>>from trouble and don't use such constructs for portability reasons or
>>
>>>push your tool vendor to support such feature. :)
>>>
>>>Best regards,
>>>Alexey
>>>
>>>Gy?rgy Réthy (IJ/ETH) wrote:
>>>
>>>
>>>
>>>>Hi,
>>>>
>>>>By default your example is invalid. The initial values of
>>>
>>>constants shall be decidable compile time. But calling any
>>>functions, including built-in ones is a run-time issue.
>>>
>>>
>>>>BR, Gyorgy
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>
Original Message
>>>>>From: active_ttcn3 : mts stf133 ttcn version 3 - active members
>>>>>only [
This email address is being protected from spambots. You need JavaScript enabled to view it.]
>>>>>Sent: Wednesday, May 25, 2005 4:24 AM
>>>>>To:
This email address is being protected from spambots. You need JavaScript enabled to view it.
>>>>>Subject: rnd() as a constant expression
>>>>>
>>>>>
>>>>>Hi all,
>>>>> Can I use a rnd function with a const float value for
>>>>>initilizing another const value, for example:
>>>>> const float c := rnd(0.1); // VALID??
>>>>>
>>>>>thanks!
>>>>>
>>>>>
>>>>>
>>>>>Best Regards
>>>>>Xiangdong Ji
>>>>>Huawei Co. Ltd
>>>>>
>>>>>
>>>>>
>>>
>
>
--
Stephan Pietsch email
This email address is being protected from spambots. You need JavaScript enabled to view it.
Testing Technologies IST GmbH web
www.testingtech.de
Rosenthaler Str. 13 phone +49 30 726 19 19 11
10119 Berlin, Germany fax +49 30 726 19 19 20