[fpc-devel]possible bug in sockets.pp

Thomas Schatzl tom_at_work at yline.com
Sat Nov 3 14:19:04 CET 2001


> > On 2 Nov 2001 Thomas.Hergenhahn at nexans.com wrote:
> >
> > > When I tried to open a socket in the unix domain bind(Sock, Addr,
> > > SizeOf(Addr)) returned the error "invalid argument", but I could not
> > > find what was wrong with my code. When I changed the definition
> > > of TUnixSockAddr in sockets.pp from:
> > >
> > > type
> > >   TUnixSockAddr = packed Record
> > >     family:word; { was byte, fixed }
> > >     path:array[0..108] of char;
> > >     end;
> >
> > That's not correct, in the C headers family is an "unsigned short",
which
> > is the same as a byte in Pascal.
>
> No, "unsigned short" equals the Pascal "Word" type (usually). Pascal
"Byte"
> equals "unsigned char".

Well forget above paragraph of mine, it's wrong. "Unsigned char" doesn't
exist and I'm starting to mix up everything. Nevertheless sizeof(unsigned
short) gives 2 with VC++. [Not that I'd take VC++ for compliance testing of
anything but it is a point].

Probably it's the alignment stuff.

Regards,
  Thomas





More information about the fpc-devel mailing list