[fpc-devel] Portability Standards

DrDiettrich drdiettrich at compuserve.de
Thu Jan 6 22:21:22 CET 2005

Michael Van Canneyt wrote:

> POSIX says nothing about pascal, it's basically a C interface.

To me POSIX means primarily the very different file handling, with
regards to devices, path separators, owner/group/world access rights
etc. This is what bites not only me when porting GNU software to

> The FPC baseunix/unix units mimic more or less the POSIX standard

As already mentioned, I couldn't find these units :-(

> No. TStream. An archive stream does not have a handle.

It was so in my first approach. But you are right, an archive or
decompressor stream should use an input stream, as provided by the
calling application.

> > That's why I choose the well defined C names for now, like size_t,
> > off_t.
> 1. They are not "well-defined", but this is another story :-)

Hmm, I refer to the GNU libc documentation, so I thought that some types
and procedures are well specified there.

> 2. I absolutely HATE underscores in types/variables/whatever
>    for documentation purposes it is a horror (I use TeX)

I also don't like underscores, but for porting IMO it's a *must* to
retain these names. How else should somebody know which Pascal names to
use for these types?

> > Apropos optimization, in many FPC units I found constructs like:
> >   if x = 0 then f(0) else f(x)
> > In these cases the IF is superfluous.
> You can send a list of such things to any core member.


> > DWORD often is used for exactly 32 bits, so that Cardinal is not an
> > appropriate replacement.
> Cardinal = 32 bits _always_. Also on 64 bit.

As I understand the Delphi documentation, Integer and Cardinal have an
unspecified size. In a 16 bit environment they have 16 bits, in 32 bit
environment 32 bits. Of course one could say that even on a 64 bit
machine the most frequently used numbers will have 32 bits as well...

> > Perhaps we should discuss the (new and old) data types explicitly, for a
> > precise description of the intended use, naming, and general properties
> > (signedness, fixed or minimum bit size...).
> The old are not subject to discussion.

It would make life easier, with regards to 64 bit machines, 64 bit file
sizes etc.  I definitely see no problems when the file-size types
(off_t) would be retyped from LongInt into e.g. TFileSize in the TStream
class(es). This is one of the rare cases where one can learn from
Windows and C ;-)


More information about the fpc-devel mailing list