Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-05

Porting C variable declaration

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Darius Blaszyk

Hi,

I came across a pointer variable in C which also get's assigned integer values. Anyone has an idea how to port this in FPC?

The variable is declared as:

static void *x=0;
Later on it get's assigned as this: x= 1;

Regards, Darius

Jonas Maebe
to Darius Blaszyk
Darius Blaszyk wrote 7 lines
I came across a pointer variable in C which also get's assigned integer values. Anyone has an idea how to port this in FPC? The variable is declared as: static void *x=0; Later on it get's assigned as this: x= 1;
var
  x: pointer;
begin
  x:=nil; { 0 is guaranteed to map to NULL/nil in C }
  x:=pointer(1);
end.
Darius Blaszyk
to Jonas Maebe

Thanks Jonas!

Jonas Maebe schreef op 4 mei '13:

Show quoted text 13 lines
On 04 May 2013, at 10:25, Darius Blaszyk wrote: > I came across a pointer variable in C which also get's assigned integer values. Anyone has an idea how to port this in FPC? The variable is declared as: static void *x=0; Later on it get's assigned as this: x= 1; var x: pointer; begin x:=nil; { 0 is guaranteed to map to NULL/nil in C } x:=pointer(1); end. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal [1]

Links:
------
[1] http://lists.freepascal.org/mailman/listinfo/fpc-pascal