Subject: Re: SDL-News: Casting?
From: Rick Reed TSE (rickreed#tseng.co.uk)
Date: Fri Dec 18 1998 - 10:28:43 GMT
The originator of this message is responsible for its content.
-----From Rick Reed TSE <rickreed#tseng.co.uk> 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
This is not generally supported in current SDL. That is, if you define
NEWTYPE Y INHERITS X
there are not (generally) the casting operations
The need for this is recognised and it will (probably) be a general feature
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 email: rickreed#tseng.co.uk http://www.tseng.co.uk ftp://ftp.tseng.co.uk/tseng/
-----End text from Rick Reed TSE <rickreed#tseng.co.uk> to sdlnews ----- For help, email "majordomo#sdl-forum.org" with the body of your email as: help or (iff this does not answer your question) email: owner-sdlnews#sdl-forum.org
This archive was generated by hypermail 2a23 : Sun Jun 16 2013 - 10:41:40 GMT