🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #53562

Re: arrays of pointers and "incompatible pointer" warnings

#53562
From: Bob Davis
Date: Tue, 29 Oct 1991 13:53
44 lines
2124 bytes
Oops.
My previous message was in error in a detail which looks like it might
be the whole crux of the problem.

In article <1991Oct28.215929.4475@viewlogic.com>, I write
> 
> I commonly create artificial argc/argv arg lists, which act like main's
> argc/argv.  This is so the readers of the implementation of individual
> commands of a program can understand what's happening.
> 
> Anyhow, code like this looks something like
> ----------------
> static int
> go_figure(int argc, char *argv[]);
> ....

It turns out that my problem only occurs when this declaration is
----------------
static int
go_figure(int argc, const char *argv[]);
----------------

Then I get the warning as stated before on the line
>...
>     did_it_work = go_figure(argc, argv);
>

about incompatible pointer types.
> lala.c: In function a_function:
> lala.c:13: warning: argument passing between incompatible pointer types

Removing const makes the pointers compatible -- implying that
const char *[] is incompatible with char **.   This seems wrong,
since one should be able to call a function with a parameter
having const pointers and arrays -- that just restricts the called
function from changing the array address or what it points to.

Is this a bug or a "feature"?

Again, apologies about the former omission.
-- 
Bob Davis (bobdavis@viewlogic.com)
hmmmming along
Technical Details
Message-ID: <1991Oct29.135344.5109@viewlogic.com>
Path: arc1-ca.pugleaf.net!gmdzi!zeus.ieee.org!dorm.rutgers.edu!rutgers!dimacs.rutgers.edu!mips!samsung!viewlog.viewlogic.com!bobdavis
References: <1991Oct28.215929.4475@viewlogic.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,cfce2e2da9583e5
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1991-10-29 08:53:31 PST
Path: arc1-ca.pugleaf.net!gmdzi!zeus.ieee.org!dorm.rutgers.edu!rutgers!dimacs.rutgers.edu!mips!samsung!viewlog.viewlogic.com!bobdavis
From: bobdavis@viewlogic.com (Bob Davis)
Newsgroups: gnu.gcc.help
Subject: Re: arrays of pointers and "incompatible pointer" warnings
Keywords: prototypes, arrays of pointers
Message-ID: <1991Oct29.135344.5109@viewlogic.com>
Date: 29 Oct 91 13:53:44 GMT
References: <1991Oct28.215929.4475@viewlogic.com>
Sender: news@viewlogic.com
Organization: Viewlogic Systems, Inc.
Lines: 44
Originator: bobdavis@mighty
Nntp-Posting-Host: mighty