Peter Gerwinski wrote:
According to Frank Heckenbach:
While we're at it: would it be possible to have predefined Pascal types as size_t and ptrdiff_t (and maybe other types?) so that such calculations can be done in Pascal?
Not enough integer types yet? ;-)
:-)
(But, fortunately, they're not really new types, just the same types with different names...)
This can be be implemented with
Type PtrInt = Integer ( BitSizeOf ( Pointer ) );
Is this sufficient?
Can there be any problems with signedness, or is it guaranteed that ptrdiff_t is always signed and of the same size as a pointer? (I should think so, but after all I've heard in the last time about such things, I'm getting very careful...) If this is portable, there's no need to predefine this type.
What about size_t? In BP, I've always used "Word" for memory sizes, and at least for DJGPP and Linux, this would work in gpc, too. But also on other machines (Alpha)? If not, I don't see a way to define size_t in Pascal, so it might have to be predefined...
So perhaps only one more integer type (for now)... :-)
-- Frank Heckenbach, Erlangen, Germany heckenb@mi.uni-erlangen.de http://www.mi.uni-erlangen.de/~heckenb/links.htm