This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Document PTR2XX and INT2PTR.
authorJarkko Hietaniemi <jhi@iki.fi>
Sat, 26 Aug 2000 04:40:41 +0000 (04:40 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Sat, 26 Aug 2000 04:40:41 +0000 (04:40 +0000)
p4raw-id: //depot/perl@6832

pod/perlguts.pod

index b1cd636..74b901d 100644 (file)
@@ -1898,6 +1898,29 @@ For example:
 
 The IVdf will expand to whatever is the correct format for the IVs.
 
+If you are printing addresses of pointers, use UVxf combined
+with PTR2UV(), do not use %lx or %p.
+
+=head2 Pointer-To-Integer and Integer-To-Pointer
+
+Because pointer size does not necessarily equal integer size,
+use the follow macros to do it right.
+
+       PTR2UV(pointer)
+       PTR2IV(pointer)
+       PTR2NV(pointer)
+       INT2PTR(pointertotype, integer)
+
+For example:
+
+       IV  iv = ...;
+       SV *sv = INT2PTR(SV*, iv);
+
+and
+
+       AV *av = ...;
+       UV  uv = PTR2UV(av);
+
 =head2 Source Documentation
 
 There's an effort going on to document the internal functions and