[BLACKBOX] [Fwd: Re: [BLACKBOX] Another trap during compile]

From: Oleg N. Cher <"Oleg>
Date: Thu, 21 Oct 2010 12:24:33 +0300

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{([at]})nowhere.xy

attached mail follows:





Received on Thu Oct 21 2010 - 11:24:33 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:29 UTC