public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/7273: having problem with pointer to pointer with const in function calling
@ 2002-07-11  5:27 paolo
  0 siblings, 0 replies; 2+ messages in thread
From: paolo @ 2002-07-11  5:27 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, paolo, send2pradeep

Synopsis: having problem with pointer to pointer with const in function calling

Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Thu Jul 11 05:27:46 2002
Responsible-Changed-Why:
    .
State-Changed-From-To: open->closed
State-Changed-By: paolo
State-Changed-When: Thu Jul 11 05:27:46 2002
State-Changed-Why:
    Duplicate of 7271

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7273


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c/7273: having problem with pointer to pointer with const in function calling
@ 2002-07-11  5:06 send2pradeep
  0 siblings, 0 replies; 2+ messages in thread
From: send2pradeep @ 2002-07-11  5:06 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7273
>Category:       c
>Synopsis:       having problem with pointer to pointer with const in function calling
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 11 05:06:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Pradeep S
>Release:        gcc 2.95.3 suse linux 7.2 build
>Organization:
>Environment:
suse linux 7.2
>Description:
i have a function of following kind. Which means to my understanding, ppi is a pointer to pointer to constant integer. ie (**ppi cannot be modified).

void func(const int **ppi)
{
}

i tried to call this function like this

int main()
{
int **ppi;
//some initialization of ppi stuff
func(ppi);
return 1;
}

when i compile this, i am getting a warning, which i feel wrong.
it says argument has pointer type mismatch. 

i am passing a modifiable data to a function which will not modify the data(hence const, in the hope that in future it may be passed some constant, which does happen in my code). 
can u tell a scenario in which this can lead to disaster? so, what does the warning signify?

similarly
when formal argument is of type
int *const **pppi;

and actual argument is of type
int ***pppi;
it says a warning.

but it didnot say anything when formal argument is
int *const *ppi
and actual argument is
int **ppi

what is the diff in above three cases that causes first two to throw a warning while third compiled quitely?

am i bugging u too much?
>How-To-Repeat:
not appilcaple
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-07-11 12:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-11  5:27 c/7273: having problem with pointer to pointer with const in function calling paolo
  -- strict thread matches above, loose matches on Subject: below --
2002-07-11  5:06 send2pradeep

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).