Article View: gnu.gcc.help
Article #52288Problems with pointers to void pointers
From: Ruud Cox
Date: Fri, 11 Dec 1992 00:41
Date: Fri, 11 Dec 1992 00:41
40 lines
1639 bytes
1639 bytes
Hai,
When porting our c libraries from Sun to GNU C, we encountered the following
problem.
test_voidpp(void **parameter)[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[Dfunction(void **parameter)
{
}
main()
{
int *integer_p;
test_function(&integer_p);
}
When compiling the above program, GNU C 2.3.1 gives:
test.c: In funcion 'main':
test.c:10: warning: passing arg 1 of 'test_funtion' from incompatible pointer
type
To my knowledge this warning is wrong. If a function expects a pointer to a
void pointer, it in fact expects a pointer to a random pointer type.
We could change void** to void *[D[D[D[D[D[D[D[D[D[D[D[D ** to void *, but then we can pass 'interger_p' without
'&' to the funtion without the compiler giving an error.
[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[A[A[A[A[A[A[A[C[C[C[C[C[C[C[C[C[C[C[C[C[C[C[C[C[C[C[C[C[C[C[C[Ccti
What is wrong in our program?
Thanks in advance
Ruud Cox
Netherlands[A
[24H[C[C[C[C[C[C[C[C[C[C[C
ruud@zuma.audacter.nl
[Ae-mail: ruud@zuma.audacter.nl
Technical Details
Message-ID:
<9212101941.AA38.V1.4@zuma.audacter.nl>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!zuma.AUdacter.NL!ruudShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,ee3a55577b51a351,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1992-12-10 11:07:20 PST Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!zuma.AUdacter.NL!ruud From: ruud@zuma.AUdacter.NL (Ruud Cox) Subject: Problems with pointers to void pointers Message-ID: <9212101941.AA38.V1.4@zuma.audacter.nl> Sender: daemon@cis.ohio-state.edu Organization: GNUs Not Usenet Distribution: gnu Date: Fri, 11 Dec 1992 00:41:29 GMT Lines: 40