Dear Chris,

I see, you believe that I need more fundamental knowledges while
reporting to OMinc about undesirable trap, because all we need a
stable and predictable our lovely BlackBox Component Builder.

I understand what type cast in this code is not need.
Target of this simplified example is only report.

And what you think about real code, that looks so:

MODULE XGrSettings;

TYPE
 ScreenDepthBits8  = BYTE;
 ScreenDepthBits16 = SHORTINT;
 ScreenDepthBits32 = INTEGER;
 Color* = ScreenDepthBits8;

 ...

END XGrSettings.

PROCEDURE RGB* (r, g, b: SHORTCHAR): Color;
BEGIN
 RETURN SYSTEM.VAL(Color, Sdl.MapRGB(screen.format,
       SYSTEM.VAL(UInt8, r), SYSTEM.VAL(UInt8, g), SYSTEM.VAL(UInt8, b)))
END RGB;

Probably you agree what optional set screen deep as type in module Settings
is a good way. And if I want to do it in this way, I need type casting with
type Color which has variable size.

Chris Burrows wrote:

 > In your test example you don't need, and should not use, a typecast 
because
 > the assignment-compatibility rules in Component Pascal also apply to 
RETURN
 > statements. The relevant rule is:

> PROCEDURE A* (): LONGINT;
> BEGIN
>   RETURN MapRGB()
> END A;

Respectfully yours,
Oleg N. Cher, from Vedanta software

----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV@LISTS.OBERON.CHOBER