comp.lang.ada
 help / color / mirror / Atom feed
From: Hyman Rosen <hyrosen@mail.com>
Subject: Re: A curiosity...
Date: Thu, 04 Dec 2008 16:48:59 -0500
Date: 2008-12-04T16:48:59-05:00	[thread overview]
Message-ID: <ffYZk.17574$st1.15396@newsfe10.iad> (raw)
In-Reply-To: <d49568ae-d205-457f-bf10-61e08b23b858@t26g2000prh.googlegroups.com>

Adam Beneschan wrote:
> Ahhh, sanity at last...

In fact, that "chilling" code wasn't really bad. It's just that
pthread_create gets a void * final parameter which it passes along
as an argument to the thread function it starts. The tutorial code
wants to pass in a plain integer, so it casts the integer into a
pointer so that it can pass it to pthread_create and then the thread
routine casts it back to an integer.

On any conventional architecture, casting a small integer to pointer
and back will leave its value unchanged, and the ability to do this
very common in C compilers and has been for decades.



  reply	other threads:[~2008-12-04 21:48 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 [this message]
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
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