🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1483

Problems with pointer to pointer to void (type[Pparameter passing)

#1483
From: 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
Technical Details
Message-ID: <9212241609.AA36.V1.4@zuma.audacter.nl>
Path: arc1-ca.pugleaf.net!sparky!uunet!crdgw1!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!zuma.AUdacter.NL!ruud

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!crdgw1!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!zuma.AUdacter.NL!ruud
From: ruud@zuma.AUdacter.NL (Ruud Cox)
Newsgroups: gnu.gcc.bug
Subject: Problems with pointer to pointer to void (type[Pparameter passing)
Message-ID: <9212241609.AA36.V1.4@zuma.audacter.nl>
Date: 24 Dec 92 21:09:03 GMT
Sender: gnulists@ai.mit.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 49
Approved: bug-gcc@prep.ai.mit.edu