comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: A curiosity...
Date: Fri, 5 Dec 2008 12:59:56 -0800 (PST)
Date: 2008-12-05T12:59:56-08:00	[thread overview]
Message-ID: <a8921a35-3153-49c5-8e81-4563d7817f31@a26g2000prf.googlegroups.com> (raw)
In-Reply-To: lnprk6s7a8.fsf@nuthaus.mib.org

On Dec 5, 12:20 pm, Keith Thompson <ks...@mib.org> wrote:
> Hyman Rosen <hyro...@mail.com> writes:
> > Keith Thompson wrote:
> >> Except that there's no guarantee in C that converting an int to void*
> >> and back again will yield the original int value.
>
> > There's a guarantee in your implementation's documentation.
>
> Maybe.  The result of converting an integer to a pointer type, or vice
> versa, is implementation-defined, which means the implementation must
> document it.  It's not at all clear what level of detail is required,
> but you can *probably* determine whether it works the way you want.
> Which it might not.

This thread started with a comment about a tutorial that showed
students the "right" way to accomplish a certain task.  What do you
want to bet that this tutorial didn't say "This works only for such-
and-such implementations", nor "Check your implementation's
documentation to make sure the size of the pointer and integer are the
same"---but rather, that it presented its solution as if this were the
right solution with no regard for the particular implementation, host,
or target?  And students are learning to program from resources like
this.

                                 -- Adam




  reply	other threads:[~2008-12-05 20:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-04 20:47 A curiosity mockturtle
2008-12-04 21:17 ` Adam Beneschan
2008-12-04 21:48   ` Hyman Rosen
2008-12-04 22:04     ` Ludovic Brenta
2008-12-04 22:10       ` Ludovic Brenta
2008-12-04 22:24         ` Hyman Rosen
2008-12-05  8:02         ` Samuel Tardieu
2008-12-05 11:51           ` Peter C. Chapin
2008-12-05 13:09           ` Martin Krischik
2008-12-05 15:15             ` Hyman Rosen
2008-12-06 13:26             ` Peter C. Chapin
2008-12-05 16:37           ` Keith Thompson
2008-12-04 22:19       ` Hyman Rosen
2008-12-05  9:03       ` Georg Bauhaus
2008-12-04 22:30 ` Randy Brukardt
2008-12-04 22:57   ` Hyman Rosen
2008-12-05 16:42     ` Keith Thompson
2008-12-05 16:57       ` Hyman Rosen
2008-12-05 20:20         ` Keith Thompson
2008-12-05 20:59           ` Adam Beneschan [this message]
2008-12-06 22:53             ` Hyman Rosen
2008-12-06 23:15               ` Gary Scott
2008-12-08 15:39                 ` Hyman Rosen
replies disabled

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