comp.lang.ada
 help / color / mirror / Atom feed
From: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson)
Subject: Re: How to print Task_ID type? (GNAT SunOS)
Date: 1996/04/06
Date: 1996-04-06T00:00:00+00:00	[thread overview]
Message-ID: <4k50tc$7ge@mulga.cs.mu.OZ.AU> (raw)
In-Reply-To: 4k1ma9$brt@michp1.redstone.army.mil

joel@redstone.army.mil (Joel Sherrill) writes:

> I am not sure what the origin of the "%p" printf specifier is but it is
> present for all the C libraries I use.  With it, you can:
>
>   printf( "The address of X is %p\n", &X );

Incidentally, that code fragment has undefined behaviour.
You need to write

    printf( "The address of X is %p\n", (void *) &X );

This is because the C standard allows implementations to represent different
pointer types differently.

(What relevance does this have to comp.lang.ada?  Just another example
of how easy it is to shoot yourself in the foot in languages with less
compile-time and run-time checking.)

--
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.




  reply	other threads:[~1996-04-06  0:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-03  0:00 How to print Task_ID type? (GNAT SunOS) Greg Bond
1996-04-04  0:00 ` Robert Dewar
1996-04-04  0:00   ` Greg Bond
1996-04-05  0:00     ` Robert Dewar
1996-04-05  0:00     ` Keith Thompson
1996-04-05  0:00       ` Greg Bond
1996-04-05  0:00       ` Robert Dewar
1996-04-06  0:00         ` Keith Thompson
1996-04-06  0:00           ` Robert Dewar
1996-04-07  0:00           ` Keith Thompson
1996-04-04  0:00   ` Greg Bond
1996-04-05  0:00   ` Laurent Guerby
1996-04-04  0:00     ` Joel Sherrill
1996-04-06  0:00       ` Fergus Henderson [this message]
1996-04-06  0:00         ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox