Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2003-10

proposition changes in unit TYPES

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

darekM

I try use FPC 1.1 for Windows
and I have problem with some of types declarations for example THandle is declared many times

in WINDOWS.PP (base.inc) is:

  Thandle= HANDLE = type Cardinal;
in CLASSES (classesh.inc)
  THANDLE = longint;

in SYSUTILS

with other types like POINT RECT I have similar problems: many collisions with different types

in 1.1RTL is unit TYPES but for me is not good

I suggest to prepare TYPES to fundamental unit
declares in it all common types
and reuse them in CLASSES, WINDOWS, UNITS
but TYPES must not use any unit, (delete WINDOWS, SYSUTILS from interface) with this changes can be avoid problems with misplaced types

Darek

www.emadar.com

Reply by email

Peter Vreman
to darekM
Show quoted text 24 lines
I try use FPC 1.1 for Windows and I have problem with some of types declarations for example THandle is declared many times in WINDOWS.PP (base.inc) is: Thandle= HANDLE = type Cardinal; in CLASSES (classesh.inc) THANDLE = longint; in SYSUTILS with other types like POINT RECT I have similar problems: many collisions with different types in 1.1RTL is unit TYPES but for me is not good I suggest to prepare TYPES to fundamental unit declares in it all common types and reuse them in CLASSES, WINDOWS, UNITS but TYPES must not use any unit, (delete WINDOWS, SYSUTILS from interface) with this changes can be avoid problems with misplaced types

When it is such a common unit the types can also be defined in the system unit. But we want to stay as much as compatible as possible. And that is not always easy especially not with the Windows specific delphi issues like THandle.

For the THandle it needs to be defined in Windows unit and can then uses as 'type renaming' in units like Sysutils

type
  THandle=Windows.THandle

But that will then need an $ifdef win32. So it needs to be investigated better where to define basic types so they can be used and should be redefined for compatibility.

Reply by email

darekM
to Peter Vreman: When it is such a common unit the types can also be defined in the system unit. But we…

----- Original Message -----

Earlier message 89 lines
From: "Peter Vreman" To: Sent: Thursday, October 02, 2003 2:04 PM Subject: Re: [fpc-devel]proposition changes in unit TYPES > > I try use FPC 1.1 for Windows > > and I have problem with some of types declarations > > for example THandle is declared many times > > > > in WINDOWS.PP (base.inc) is: > > > > Thandle= HANDLE = type Cardinal; > > > > in CLASSES (classesh.inc) > > THANDLE = longint; > > > > in SYSUTILS > > > > with other types like POINT RECT I have similar problems: many collisions > > with different types > > > > in 1.1RTL is unit TYPES but for me is not good > > > > > > I suggest to prepare TYPES to fundamental unit > > declares in it all common types > > and reuse them in CLASSES, WINDOWS, UNITS > > but TYPES must not use any unit, (delete WINDOWS, SYSUTILS from interface) > > with this changes can be avoid problems with misplaced types > > When it is such a common unit the types can also be defined in the system > unit. But we want to stay as much as compatible as possible. And that is > not always easy especially not with the Windows specific delphi issues > like THandle. not all types must be in SYSTEM, but need to avoid two identical identifier with different types variable MAININSTANCE in SYSTEM need be the same type like THandle > > For the THandle it needs to be defined in Windows unit and can then uses > as 'type renaming' in units like Sysutils > > type > THandle=Windows.THandle But what I can do with THandle in CLASSES I Lazarus FPC one times get Thandle form CLASSES , second time from WINDOWS - that's not good > > But that will then need an $ifdef win32. So it needs to be investigated > better where to define basic types so they can be used and should be > redefined for compatibility. my proposition is : in unit TYPES (or in SYSTEM or another COMMON unit) {$IFDEF WIN32} THandle= cardinal {$ELSE} THandle=integer {$ENDIF} and if all unit (CLASSES, WINDOWS etc.) uses TYPES; and if need THANDLE=types.THANDLE in SYSUTILS for other platform some times THandle is declared and some times not, I think is not good PS. I send this message second time, but I've not got error > > > > _______________________________________________ > fpc-devel maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-devel >

Reply by email