Mailinglist Archive: opensuse (3349 mails)

< Previous Next >
Re: [SLE] pthread doesn't work on SUSE 9.2 ?
  • From: Anders Johansson <andjoh@xxxxxxxxxx>
  • Date: Thu, 26 May 2005 02:57:56 +0200
  • Message-id: <200505260257.56136.andjoh@xxxxxxxxxx>
On Thursday 26 May 2005 02:08, Jerry Feldman wrote:
> The C standard does NOT say that a char is 8 bits. It says that it must
> be at least 8 bits.

Fair enough

> As I mentioned, it happens to be a common practice in pthread
> programming to pass an int directly into the thread entry.

Many things have at various times been common practice. This does not make it
right, or even good practice.

> The prototype for a pthread start routine is:
> void *functionname(void *);
> The C language does permit the assignment of an integral to a pointer
> and vice-versa, but truncation and/or unexpected sign extension can
> occur.

Well, as I mentioned, it is implementation defined. Which means you are
creating a program that is not guaranteed to be portable to other compilers.

I didn't know gcc explicitly allowed this, I've never bothered to look at it.
Frankly I see little point in doing it. It seems to me it only serves to make
programs that much less readable. I'm trying to think of benefits, but so far
they escape me


< Previous Next >
Follow Ups