Re: [PATCH] _AC_C_C99_TEST_GLOBALS, _AC_C_C99_TEST_MAIN: support GCC's -Wc++-compat

"Andrew W. Nosenko" <[email protected]> Wed, 13 Aug 2025 16:10:37 +0200
Newsgroups gmane.comp.sysutils.autoconf.patches
Message-ID <CALa-7vxNv5AMcVvJvs2mCFjqA_RTuxruf7hB9B1PCZjMA28Z4g@mail.gmail.com>
--00000000000033a873063c3fb949
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

First time ever hear about C compiler that complain about implicit cast
from void* to another pointer.  Which compiler is it?

Sent from mobile


On Wed, 13 Aug 2025 at 14:58, Dave Hart <[email protected]> wrote:

> On Thu, Aug 7, 2025 at 8:52=E2=80=AFPM Paul Eggert <[email protected]> w=
rote:
>
>> That thing with malloc goes too far. 'char *p =3D malloc (...);' is a go=
od
>> idiom in C, and it's silly and even counterproductive to require a cast.
>
>
> I completely agree.  Adding the cast requires duplicating the type, slows
> comprehension, and invites copy/paste mischief.
>
>
>> I worked around the glitch by not using malloc.
>
>
> I've seen this sort of change elsewhere.  I'm guessing at least one
> compiler is emitting a warning without the superfluous cast.  Can someone
> enlighten me why some folks apparently believe an implicit cast from void
> pointer to another pointer is evil?
>
> Cheers,
> Dave Hart
>
>

--00000000000033a873063c3fb949
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">First time ever hear about C compiler that complain about=
 implicit cast from void* to another pointer.=C2=A0 Which compiler is it?<b=
r clear=3D"all"><br clear=3D"all"><div><div dir=3D"ltr" class=3D"gmail_sign=
ature" data-smartmail=3D"gmail_signature">Sent from mobile</div></div></div=
><div><br></div><div><br><div class=3D"gmail_quote gmail_quote_container"><=
div dir=3D"ltr" class=3D"gmail_attr">On Wed, 13 Aug 2025 at 14:58, Dave Har=
t &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; wrot=
e:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bo=
rder-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div dir=3D"ltr=
"><div><div class=3D"gmail_default" style=3D"font-family:&quot;trebuchet ms=
&quot;,sans-serif"><span style=3D"font-family:Arial,Helvetica,sans-serif">O=
n Thu, Aug 7, 2025 at 8:52=E2=80=AFPM Paul Eggert &lt;<a href=3D"mailto:egg=
[email protected]" target=3D"_blank">[email protected]</a>&gt; wrote:</span>=
</div></div></div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quo=
te" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204=
);padding-left:1ex">
That thing with malloc goes too far. &#39;char *p =3D malloc (...);&#39; is=
 a good <br>
idiom in C, and it&#39;s silly and even counterproductive to require a cast=
.</blockquote><div><br></div><div><div class=3D"gmail_default" style=3D"fon=
t-family:&quot;trebuchet ms&quot;,sans-serif">I completely agree.=C2=A0 Add=
ing the cast requires duplicating the type, slows comprehension, and invite=
s copy/paste mischief.</div></div><div>=C2=A0</div><blockquote class=3D"gma=
il_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,2=
04,204);padding-left:1ex">
I worked around the glitch by not using malloc.</blockquote><div><br></div>=
<div><div class=3D"gmail_default" style=3D"font-family:&quot;trebuchet ms&q=
uot;,sans-serif">I&#39;ve seen this sort of change elsewhere.=C2=A0 I&#39;m=
 guessing at least one compiler is emitting a warning without the superfluo=
us cast.=C2=A0 Can someone enlighten me why some folks apparently believe a=
n implicit cast from void pointer to another pointer is evil?</div></div><d=
iv class=3D"gmail_default" style=3D"font-family:&quot;trebuchet ms&quot;,sa=
ns-serif"><br></div><div><div dir=3D"ltr" class=3D"gmail_signature"><div di=
r=3D"ltr"><font face=3D"tahoma, sans-serif" color=3D"#666666">Cheers,<br>Da=
ve Hart</font></div></div></div><br></div></div>
</blockquote></div></div>

--00000000000033a873063c3fb949--