Subject: SDL-News: Un-intuitive Type System
From: Patrick Frend (patrick#frend.demon.co.uk)
Date: Mon Jun 16 2003 - 17:13:38 GMT
Become an SDL Forum Society member <http://www.sdl-forum.org/Society/members.htm>
The originator of this message is responsible for its content.
-----From "Patrick Frend" <patrick#frend.demon.co.uk> to sdlnews -----
Is it just me or is some of the symantics of the SDL type
system un-intuitive. You could even go so far as saying
"Dangerous" and I'd have a hard time dis-agreeing.
For example:
I need a type in various different contexts which may only
have a positive integral value that will fit into 16 bits
So I define
SYNTYPE PositiveInteger = Natural
CONSTANTS 1:65535
DEFAULT 1
ENDSYNTYPE;
Now this range of values is used in the
protocol for various different uses, so I want to separate
the types. So intuitively I define.
SYNTYPE MadeUpUseOne = PositiveInteger
ENDSYNTYPE;
SYNTYPE MadeUpUseTwo = PositiveInteger
ENDSYNTYPE;
I define 2 variables.
DCL instanceOne MadeUpUseOne;
DCL instanceTwo PositiveInteger;
Question1: What value do each of the variables have immediately after
declaration?
Question2: What range of values that each of the variables may be assigned?
You may have to delve right into the small-print of the SDL language spec to
get the
"correct" answers. I did, but still don't understand!
Are there any other strange, but commonly used constructs lurking out there
waiting
to bite?
Patrick Frend
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.488 / Virus Database: 287 - Release Date: 05/06/2003--End text from "Patrick Frend" <patrick#frend.demon.co.uk> to sdlnews --- For extra SDL Forum Society benefits join at <http://www.sdl-forum.org/Society/members.htm>
This archive was generated by hypermail 2a23 : Thu May 09 2013 - 16:05:49 GMT