On Tue, Jan 15, 2008 at 04:09:02PM -0800, Mark Schoonover wrote:

   p = (int*) 42;

my $p = \42;

Um, no, that creates a box with a 42 in it, and stores a reference to the
42 in $p.  The C code sets the pointer to 42.  You can't have a Perl
reference that doesn't point to a real Perl object, at least not without
calling out to C.

In perl

  print $$p, "\n";

prints 42.  The C code.

  printf ("%d\n", *p);

SEGFAULTs.  Very different.

Dave

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

Reply via email to