From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10b612,5dfc36d70460b825,start X-Google-Attributes: gid10b612,public X-Google-Thread: fee84,5dfc36d70460b825,start X-Google-Attributes: gidfee84,public X-Google-Thread: 1164f8,5dfc36d70460b825,start X-Google-Attributes: gid1164f8,public From: john@iastate.edu (John Hascall) Subject: cc -proto[is] produces fubar results? Date: 1996/03/10 Message-ID: <4hv1oc$g8i@news.iastate.edu>#1/1 X-Deja-AN: 142248107 organization: Iowa State University, Ames, Iowa USA newsgroups: comp.sys.dec,comp.unix.ultrix,comp.unix.osf.osf1 (I get identical results under Ultrix V4.3a and Digital Unix V3.2a) Doing: "cc -protoi sample.c" (see sample.c below) gives a sample.H of: extern int (int (* )argc , char * * argv)ifunc(struct xcmd * tbl , char * item); It seems to me that this isn't even close to legal C, right? ------------------------------- sample.c --------------------------------- struct xcmd { char * xc_name; int (* xc_ifunc)(); }; /* * declare ifunc as function (tbl as pointer to struct xcmd, * item as pointer to char) returning * pointer to function (argc as int, * argv as pointer to pointer to char) returning int */ int ( * ifunc ( struct xcmd * tbl, char * item ) ) ( int argc, char ** argv ) { struct xcmd * xc; for (xc = tbl; xc->xc_name != (char*)0; ++xc) { if (strcasecmp(item, xc->xc_name) == 0) break; } return xc->xc_ifunc; } ------------------------------------------------------------------------------- -- John Hascall ``An ill-chosen word is the fool's messenger.'' Moderator, comp.unix.wizards Systems Software Engineer, ISU Comp Center + Ames, IA 50011 + 515/294-9551 My Homepage From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10b612,5dfc36d70460b825 X-Google-Attributes: gid10b612,public X-Google-Thread: fee84,5dfc36d70460b825 X-Google-Attributes: gidfee84,public X-Google-Thread: 1164f8,5dfc36d70460b825 X-Google-Attributes: gid1164f8,public From: carlson@kikkin.zko.dec.com (Tom Carlson) Subject: Re: cc -proto[is] produces fubar results? Date: 1996/03/12 Message-ID: <4i4kpq$qdj@zk2nws.zko.dec.com>#1/1 X-Deja-AN: 142756243 distribution: world references: <4hv1oc$g8i@news.iastate.edu> organization: Digital Equipment Corporation reply-to: carlson@kikkin.zko.dec.com (Tom Carlson) newsgroups: comp.sys.dec,comp.unix.ultrix,comp.unix.osf.osf1 In article <4hv1oc$g8i@news.iastate.edu>, john@iastate.edu (John Hascall) writes: |>(I get identical results under Ultrix V4.3a and Digital Unix V3.2a) |> |>Doing: "cc -protoi sample.c" (see sample.c below) gives a sample.H of: |> |>extern int (int (* )argc , char * * argv)ifunc(struct xcmd * tbl , char * item); |> |>It seems to me that this isn't even close to legal C, right? |> |>------------------------------- sample.c --------------------------------- |>struct xcmd { |> char * xc_name; |> int (* xc_ifunc)(); |>}; |> |>/* |> * declare ifunc as function (tbl as pointer to struct xcmd, |> * item as pointer to char) returning |> * pointer to function (argc as int, |> * argv as pointer to pointer to char) returning int |> */ |>int ( * ifunc ( |> struct xcmd * tbl, |> char * item |>) ) ( |> int argc, |> char ** argv |>) { |> struct xcmd * xc; |> |> for (xc = tbl; xc->xc_name != (char*)0; ++xc) { |> if (strcasecmp(item, xc->xc_name) == 0) break; |> } |> return xc->xc_ifunc; |>} |>------------------------------------------------------------------------------- |>It seems to me that this isn't even close to legal C, right? You're right, acc (invoked cc) misses the mark on this one. DEC C (currently invoked via cc -migrate) does a better job: > cat foo.H struct xcmd; extern int (*)(int argc, char * *argv) ifunc(struct xcmd *tbl, char *item); Tom -- Thomas Carlson, DEC C/ DEC C++ carlson@decc.enet.dec.com Digital Equipment Corporation, ZK2-3/N30 110 Spitbrook Rd, Nashua, NH 03062 From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10b612,5dfc36d70460b825 X-Google-Attributes: gid10b612,public X-Google-Thread: 1164f8,5dfc36d70460b825 X-Google-Attributes: gid1164f8,public X-Google-Thread: fee84,5dfc36d70460b825 X-Google-Attributes: gidfee84,public From: zeeb@jacare.zk3.dec.com (Jeff Zeeb DEC C) Subject: Re: cc -proto[is] produces fubar results? Date: 1996/03/13 Message-ID: <4i704g$qpt@zk2nws.zko.dec.com>#1/1 X-Deja-AN: 142557028 distribution: world references: <4hv1oc$g8i@news.iastate.edu> <4i4kpq$qdj@zk2nws.zko.dec.com> organization: Digital Equipment Corporation reply-to: zeeb@decc.enet.dec.com newsgroups: comp.sys.dec,comp.unix.ultrix,comp.unix.osf.osf1 In article <4i4kpq$qdj@zk2nws.zko.dec.com>, carlson@kikkin.zko.dec.com (Tom Carlson) writes: >|>Doing: "cc -protoi sample.c" (see sample.c below) gives a sample.H of: >|> >|>extern int (int (* )argc , char * * argv)ifunc(struct xcmd * tbl , char * item); > >You're right, acc (invoked cc) misses the mark on this one. >DEC C (currently invoked via cc -migrate) does a better job: Note that the DEC C compiler doesn't support the -proto switch until the V4.0 release. -- Jeff Zeeb This article represents my opinions and not those zeeb@decc.enet.dec.com of Digital Equipment Corp. (Surprise!)