[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: c-stack and Irix - libsigsegv
From: |
Peter Seebach |
Subject: |
Re: c-stack and Irix - libsigsegv |
Date: |
Sun, 21 Sep 2008 16:36:15 -0500 |
In message <address@hidden>, Eric Blake writes:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>According to Tom G. Christensen on 9/21/2008 2:30 PM:
>> cc-3316 cc: ERROR File = handler-unix.c, Line = 490
>> The expression must be a pointer to a complete object type.
>>
>> ss.ss_sp = extra_stack + extra_stack_size - sizeof (void *);
>> ^
>
>Yep - gcc allows addition of void*, but many other compilers require an
>explicit cast to char * before you can do pointer math (since C89 leaves
>pointer math on void* undefined).
C99, too, I believe. The reason being that void is an incomplete type,
and has no size. The assumption that you want to add byte-sized chunks is
probably not an unreasonable one, and I don't entirely blame gcc for
making that guess, but I am obliged to admit that I've more often been
wrong than right when I ended up trying to add something to a (void *)
pointer. I actually prefer to just require the explicit cast, which
makes it unambiguous what type I think I'm counting by.
-s
Re: c-stack and Irix - gnulib, Eric Blake, 2008/09/23