Porting C variable declaration

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Porting C variable declaration

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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Porting C variable declaration

Jonas Maebe-2

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  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Porting C variable declaration

Darius Blaszyk

Thanks Jonas!

 

Jonas Maebe schreef op 4 mei '13:

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  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal