🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #6239

Re: const and struct pointers

#6239
From: Walter Murray
Date: Mon, 26 Feb 1990 18:17
27 lines
1203 bytes
Robert Adsett:

> #include <math.h>
> struct qwert { int a; double b;};
> void asdf( struct qwert a);
> const double a = 3.0;
> void junk( const double *b, const struct qwert *c)
> {
> (void)exp(a);    /* Works */
> (void)exp(*b);   /* Works */
> asdf( *c);       /* Type mismatch ???? */
> }

>    The compiler gives a type mismatch in argument error for the line
> indicated.

Doug Gwyn:

> The compiler was correct to complain about an argument that had as its
> type "pointer to qualified type" being passed to a function expecting
> a pointer to an unqualified type.  

But in the posted example, the argument and parameter are structures,
not pointers.  It seems to me that the code is legal.

Walter Murray
----------
Technical Details
Message-ID: <12570046@hpclwjm.HP.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!usc!ucsd!ucsdhub!hp-sdd!hplabs!hp-ses!hpcuhb!hpcllla!hpclisp!hpclwjm!walter
References: <1214@watserv1.waterloo.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!usc!ucsd!ucsdhub!hp-sdd!hplabs!hp-ses!hpcuhb!hpcllla!hpclisp!hpclwjm!walter
From: walter@hpclwjm.HP.COM (Walter Murray)
Newsgroups: comp.std.c
Subject: Re: const and struct pointers
Message-ID: <12570046@hpclwjm.HP.COM>
Date: 26 Feb 90 18:17:33 GMT
References: <1214@watserv1.waterloo.edu>
Organization: Hewlett-Packard Calif. Language Lab
Lines: 27