🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Ruud Cox Thu, 24 Dec 1992 21:09
Problems with pointer to pointer to void (type[Pparameter passing)
#1483
Author: Ruud Cox
Date: Thu, 24 Dec 1992 21:09
49 lines
2382 bytes
Hai,

When we were porting our C libraries to GNU C, we encountered the following
problem:

GCC VERSION:      GNU C 3.2.1
MACHINETYPE:      Sun Sparc station IPX (sun4c)
OS VERSION:       sunos 4.1.3
CONFIGURATION:    sparc-sun-sunos4.3.1
CHANGES TO GCC:   none

COMMANDLINE ARGUMENTS: gcc -c tgcc.c

When compiling undermentioned program GNU C produces the following Warning:

tgcc: In function 'main':
tgcc[A.c: In function 'main':[B[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D.c:10: warning: passing arg 1 of 'test_voidpp' from incompatible pointer type

To my knowledge this is wrong. A cast from pointer to pointer to int is
compatible with a pointer to a pointer to a void.

We could change void ** to void *, but then we can pass 'intp' without '&' to
the funtion without the compiler giving sn error.
----------------------------------------------------------------------------
[A[C[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[C[C[C[C[C[C[C[C[C[C[C[C[C[C[Ca[B[B[H[B[B[B[B[B[B[B[B[B[B[B[B[B[B[B[B[B[B[B[B[B[B[Btest_voidpp(void **pp)
{
}

main()
{
    int *intp;

    test_voidpp(&intp);
}
-----------------------------------------------------------------[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[D[D[D[D[D[D[D[D[D[D[D
[A                       [B[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[Dtest_voidpp(void **pp)[B[H[B[B[B[B[B[B[B[B[B[B[B[B[B[B[B{
}
      [B[D[D[D[D[D[Dmain()
{
[A[C[C[C[C          [B[D[D[D[D[D[D[D[D[D[Dint *intp;
                       [B[H[B[B[B[B[B[B[B[B[B[B[B[B[B[B[B[B[B[B[B[B[B[B    test_voidpp(&intp);
                                                                  [C[C[C[C[C[C[C[C[C[C[C[C[C[C[C[A[C}
----------------------------------------------------------------------------

Ruud Cox
st. Leonardusstraat 10B[D B
5614 EH Eindhoven
Netherlands
e-mail: ruud@zuma.audacter.nl
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads