🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #53560

arrays of pointers and "incompatible pointer" warnings

#53560
From: Bob Davis
Date: Mon, 28 Oct 1991 21:59
44 lines
1781 bytes
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[]);

int
a_function(char *stuff)
{
    int argc;
    char **argv;
    ...
    make_arg_array(stuff, &argc, &argv);
    ...
    did_it_work = go_figure(argc, argv);
    ...
    dispose_of_arg_array(argc, argv);
}

static int
go_figure(int argc, char *argv[])
{
    ...
}
----------------
The problem is that on the line "...go_figure...", I get the warning

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

I've tried casting the argv arg to (char *[]) but this is uncool since
the compiler wisely says "cast to array type" or similar.
I would really prefer to keep go_figure's argv as an array of pointers
since that's what it is.

Ideas, comments, suggestions?  Anyone?
-- 
Bob Davis (bobdavis@viewlogic.com)
hmmmming along
Technical Details
Message-ID: <1991Oct28.215929.4475@viewlogic.com>
Path: arc1-ca.pugleaf.net!gmdzi!zeus.ieee.org!sdd.hp.com!think.com!samsung!viewlog.viewlogic.com!bobdavis

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,cfce2e2da9583e5,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1991-10-28 16:13:21 PST
Path: arc1-ca.pugleaf.net!gmdzi!zeus.ieee.org!sdd.hp.com!think.com!samsung!viewlog.viewlogic.com!bobdavis
From: bobdavis@viewlogic.com (Bob Davis)
Newsgroups: gnu.gcc.help
Subject: arrays of pointers and "incompatible pointer" warnings
Keywords: prototypes, arrays of pointers
Message-ID: <1991Oct28.215929.4475@viewlogic.com>
Date: 28 Oct 91 21:59:29 GMT
Sender: news@viewlogic.com
Organization: Viewlogic Systems, Inc.
Lines: 40
Originator: bobdavis@mighty
Nntp-Posting-Host: mighty