[fpc-pascal] How to fix - Hint: Type size mismatch

Graeme Geldenhuys graemeg.lists at gmail.com
Sat Nov 4 00:33:39 CET 2006


I am trying to clean up the fpGFX code and trying to get rid of all
compiler warnings.
I get the following compiler hint on every line in the RectToXRect
function. Using FPC 2.1.1 under Linux.

Hint: Type size mismatch, possible loss of data / range check error

function RectToXRect(const ARect: TRect): TXRectangle;
  Result.x      := ARect.Left;
  Result.y      := ARect.Top;
  Result.width  := ARect.Right - ARect.Left;
  Result.height := ARect.Bottom - ARect.Top;

I understand the hint, and agree with it, but what do I need to do, to
fix/remove it?  The TRect and TXRectangle are defined as shown below.
Could I cast ARect's fields to remove the hint?

   TXRectangle = record
        x, y : cshort;
        width, height : cushort;

  TRect =  record
    case Integer of
      0: (Left,Top,Right,Bottom : Longint);
      1: (TopLeft,BottomRight : TPoint);

  - Graeme -

There's no place like

More information about the fpc-pascal mailing list