On Tue, Jan 15, 2008 at 03:54:54PM -0800, Mark Schoonover wrote:

The way I understand it all is that C pointers and Perl refs are the same,
atleast in creating them.

my $ref = \$a

If you try to do arithmetic on a ref, it turns into an integer.  Can Perl
cast that back to a reference?

int *p = &a;

   p++;

or
   p = (int*) 42;

Where's the difference?

The difference between references and pointers is that a language with
references will only allow you to assign those references to valid things.
Pointers can be arbitrarily manipulated.

Usually, even interpreted languages that have C bindings will be able to
manipulate pointers, but probably in an awkward way.

Dave

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to