Re: SDL-News: Casting?

Subject: Re: SDL-News: Casting?
From: Rick Reed TSE (
Date: Fri Dec 18 1998 - 10:28:43 GMT

The originator of this message is responsible for its content.
-----From Rick Reed TSE <> to sdlnews -----

At 14:50 +0000 17/12/98, Janos Bauer wrote:
> I would like to know how supported "casting" by SDL? (Is it supported
>at all?)

This is not generally supported in current SDL. That is, if you define


there are not (generally) the casting operations


The need for this is recognised and it will (probably) be a general feature
of SDL-2000.

There are, however, some language defined operators such as



There are also some defined in Z.105 for use with Bit, Bitstring, Octet and
OctetString, and tool vendors provide additional tool specific operators
(which should of course be marked as non-standard because they are not tool

As Fix/Float are both defined on Integer

NEWTYPE myInt INHERITS Integer ...

NEWTYPE anotherInt INHERITS Integer

also inherits these operators so that it is possible to write:

DCL myintvar myInt, anotherIntvar anotherInt;
myintvar := FIX(FLOAT(anotherintvar))

and the appropriate FIX and FLOAT operators are resolved by context. This
is, of course, not very elegant but it works. However, it you are
generating executable code from the SDL, it is probably a good idea to
check that the code generation has recognised the no actual conversion
should be necessary.

Obviously the same approach could be used with some other built-in
operators, but for a more general approach you will have to wait for
SDL-2000. Alternatively you could write your own operators or procedures,
which can be external - that is written in some other language.

Even SDL-2000 will not be able to support casting of anything to anything,
because such casting is encoding dependent, and SDL does not define

Rick Reed, TSE Limited
13 Weston House, 18-22 Church Street
Lutterworth Leicestershire LE17 4AW United Kingdom
Tel +44 14 55 55 96 55; Fax +44 14 55 55 96 58
Mob +44 79 70 50 96 50

-----End text from Rick Reed TSE <> to sdlnews ----- For help, email "" with the body of your email as: help or (iff this does not answer your question) email:

This archive was generated by hypermail 2a23 : Sun Jun 16 2013 - 10:41:40 GMT