UNIT types;
INTERFACE
{ Note: some comments should be replaced with conditional compilation directives.
This could be extended to support additional types as needed.
Note that a similar unit already exists (sint16, uint16, though), with the same name, in the standard Macintosh Pascal interfaces. }
TYPE { for GPC }
int8 = INTEGER(8); uint8 = WORD(8); int16 = INTEGER(16); uint16 = WORD(16); int32 = INTEGER(32); uint32 = WORD(32); int64 = INTEGER(64); uint64 = WORD(64);
{ for FreePascal }
int8 = SHORTINT; uint8 = BYTE; int16 = INTEGER; uint16 = WORD; int32 = LONGINT; uint32 = CARDINAL; { int64 = INT64; } uint64 = QWORD;
{ etc. }
{ for all }
STRING15 = STRING[15]; STRING31 = STRING[31]; STRING63 = STRING[63]; STRING127 = STRING[127]; STRING255 = STRING[255];
IMPLEMENTATION
{ no implementation for types abstraction unit }
END.
--- "J. David Bryan" dbryan@bcpl.net wrote:
On 15 Dec 2002 at 3:33, Frank Heckenbach wrote:
Yes, plain integers I suppose, not integers with a specified width of 32 bits.
What is a "plain" integer? Is there a guarantee that a "plain" integer in GNU C or Pascal will be the same size as a "plain" integer in Microsoft C (e.g.)?
I take the point that a WordBool is guaranteed to be the same size as a Word in GNU Pascal or an unsigned int in GNU C and therefore should be used in preference to a sized type when interfacing to other GNU modules. But is that guarantee extended to Microsoft compilers? When interfacing to a module supplied by Microsoft (or any third party), the interface requires certain parameter sizes, regardless of how they were originally defined. They may happen to coincide with GNU Pascal's Word or GNU C's unsigned int, but that isn't given.
Indeed, the GPC manual admits as much:
"The following variants of Integer, Cardinal and Word are guaranteed to be compatible to the integer types of GNU C. The sizes given, however, are _not_ guaranteed."
and:
"If you want to be sure that you have a signed integer with 32 bits width, write Integer (32), not just Integer which might be bigger."
The Win32 documentation from Microsoft says explicitly, for example, that an INT (defined in "windef.h" as "typedef int INT") is a "32-bit signed integer," so when interfacing, an INT parameter _must_ be 32 bits. I can declare the Pascal equivalent to be an Integer, but that doesn't guarantee me 32 bits according to the GPC manual, whereas "Integer (32)" does.
I presume all of this extends to "Boolean (32)" as well, or does "Boolean (32)" behave differently from "Integer (32)" in this regard?
You were replying to Chuck's statement: "And there is no need for such an entity." which was a comment about `Boolean (32)'.
I was commenting on the need (such as it is) for integers with Boolean semantics in general, not specifically a need for "Boolean (32)".
-- Dave
===== ======= Frank D. Engel, Jr.
__________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com