From: Jarkko Hietaniemi Date: Sat, 26 Aug 2000 04:40:41 +0000 (+0000) Subject: Document PTR2XX and INT2PTR. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8908e76d53bb0a0d1093b7e53a5526fcb8c4098d;p=p5sagit%2Fp5-mst-13.2.git Document PTR2XX and INT2PTR. p4raw-id: //depot/perl@6832 --- diff --git a/pod/perlguts.pod b/pod/perlguts.pod index b1cd636..74b901d 100644 --- a/pod/perlguts.pod +++ b/pod/perlguts.pod @@ -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