[fpc-pascal] Problem translating c code to pascal
Felipe Monteiro de Carvalho
felipemonteiro.carvalho at gmail.com
Sun Sep 24 16:37:20 CEST 2006
This is what almost works:
var
hw_handlers: array[0..1] of handler_rec =
(
(content_type: 'hw_app'; handler: @DefaultHandler),
nil
);
But the compiler will complain on the nil:
mod_hello.lpr(108,5) Fatal: Syntax error, "(" expected but "NIL" found
On 9/23/06, Marc Santhoff <M.Santhoff at t-online.de> wrote:
> Think of hardware detection, one driver may know different models it
> supports. When detection is active it simply iterates over the model
> describing struct and checks presence until the item read from the
> struct is NULL.
I still don't know how what is the inner working of this. Does that c
statement really means a static array with size two? A record cannot
be null. When you access a static record you go directly to it's
memory position of Initial_Pos + X * Record_Size, where X is the
record number. Then you cannot have a null record. The best you can
have is record whose content is null.
Or NULL could represent that the array is of size 1 not 2.
--
Felipe Monteiro de Carvalho
More information about the fpc-pascal
mailing list