Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Let us condemn to hellfire all those who disagree with us." -- militant religionists everywhere


devel / comp.lang.c / Re: Casting the return value of ...

SubjectAuthor
* Casting the return value of ...Kenny McCormack
+* Re: Casting the return value of ...Kaz Kylheku
|+* Re: Casting the return value of ...Scott Lurndal
||`* Re: Casting the return value of ...Tim Rentsch
|| `* Re: Casting the return value of ...Scott Lurndal
||  +* Re: Casting the return value of ...Lawrence D'Oliveiro
||  |+- Re: Casting the return value of ...Scott Lurndal
||  |+- Re: Casting the return value of ...David Brown
||  |`- Re: Casting the return value of ...Chris M. Thomasson
||  `* Re: Casting the return value of ...Tim Rentsch
||   `- Re: Casting the return value of ...David Brown
|`* Re: Casting the return value of ...Keith Thompson
| `* Re: Casting the return value of ...bart
|  +* Re: Casting the return value of ...Keith Thompson
|  |+- Re: Casting the return value of ...Chris M. Thomasson
|  |+* Re: Casting the return value of ...Kaz Kylheku
|  ||+* Re: Casting the return value of ...Kaz Kylheku
|  |||`* Re: Casting the return value of ...Kaz Kylheku
|  ||| `* Re: Casting the return value of ...Michael S
|  |||  `* gcc Bugzilla search (was: Casting the return value of ...)Michael S
|  |||   `- Re: gcc Bugzilla searchDavid Brown
|  ||`- Re: Casting the return value of ...Keith Thompson
|  |`* Re: Casting the return value of ...David Brown
|  | `- Re: Casting the return value of ...Chris M. Thomasson
|  `* Re: Casting the return value of ...David Brown
|   `* Re: Casting the return value of ...bart
|    +- Re: Casting the return value of ...David Brown
|    `* Re: Casting the return value of ...Tim Rentsch
|     `* Re: Casting the return value of ...bart
|      `- Re: Casting the return value of ...Tim Rentsch
+* Re: Casting the return value of ...Andrey Tarasevich
|`- Re: Casting the return value of ...Keith Thompson
`- Re: Casting the return value of ...Tim Rentsch

Pages:12
Re: Casting the return value of ...

<OKZNN.587350$PuZ9.175960@fx11.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34877&group=comp.lang.c#34877

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx11.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Casting the return value of ...
Newsgroups: comp.lang.c
References: <uu416t$33u55$1@news.xmission.com> <20240328105203.773@kylheku.com> <K0jNN.158579$zF_1.100106@fx18.iad> <86le5zipzo.fsf@linuxsc.com>
Lines: 42
Message-ID: <OKZNN.587350$PuZ9.175960@fx11.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sat, 30 Mar 2024 19:29:50 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sat, 30 Mar 2024 19:29:50 GMT
X-Received-Bytes: 2410
 by: Scott Lurndal - Sat, 30 Mar 2024 19:29 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>scott@slp53.sl.home (Scott Lurndal) writes:
>
>> Kaz Kylheku <433-929-6894@kylheku.com> writes:
>>
>>> On 2024-03-28, Kenny McCormack <gazelle@shell.xmission.com> wrote:

>> * Each shared object that simulates a Data Link Processor (DLP), will
>> * contain a single namespace-scope function <b>get_dlp</b> which constructs
>> * a DLP object of the specified type (for example, a #c_uniline_dlp,
>> * #c_card_reader_dlp, et alia). <b>get_dlp</b> returns the constructed
>> * object as a #c_dlp object to the #channel function, which is then used
>> * by the I/O subsystem to request services of the DLP at the MLI level.
>> */
>> typedef c_dlp* (*get_dlp_t)(const char *, uint64_t, c_logger *);
>> ...
>> get_dlp_t sym;
>> ...
>>
>> sym = (get_dlp_t)dlsym(handle, "get_dlp");
>> if (sym == NULL) {
>> lp->log("Invalid DLP shared object format: %s\n", dlerror());
>> unregister_handle(channel);
>> dlclose(handle);
>> return 1;
>> }
>>
>>
>>> I think there was a time in the development of GCC when there was
>>> a warning even with the cast. I don't think it's enabled by default
>>> now?
>>
>> We compile with -Wall -Werror and have never seen any warnings related to
>> casting the result of dlsym(), and we build with GCC[4..13].
>
>Do you use -pedantic? Compiling with -pedantic using gcc 8.4.0
>gives a warning diagnostic (and a fatal error if -pedantic-errors
>is specified in place of -pedantic).

Of course not. We write production code not standard C (or in this
case, C++) code. Portability to compilers other than gcc is
not a requirement for the several million line codebase.

Re: Casting the return value of ...

<uua5ra$18vsh$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34885&group=comp.lang.c#34885

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Casting the return value of ...
Date: Sat, 30 Mar 2024 23:05:14 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <uua5ra$18vsh$1@dont-email.me>
References: <uu416t$33u55$1@news.xmission.com>
<20240328105203.773@kylheku.com> <K0jNN.158579$zF_1.100106@fx18.iad>
<86le5zipzo.fsf@linuxsc.com> <OKZNN.587350$PuZ9.175960@fx11.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 30 Mar 2024 23:05:14 +0100 (CET)
Injection-Info: dont-email.me; posting-host="b0066affb4d8135fff0ad7311aa48f10";
logging-data="1343377"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18O8XP17V/LIpXUAKfHF7hp"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:zU50r0g8P4b37dO3yLR+bjXeMkU=
 by: Lawrence D'Oliv - Sat, 30 Mar 2024 23:05 UTC

On Sat, 30 Mar 2024 19:29:50 GMT, Scott Lurndal wrote:

> We write production code not standard C (or in this
> case, C++) code. Portability to compilers other than gcc is
> not a requirement for the several million line codebase.

Interesting. Has GCC become the de-facto-standard C compiler?

Re: Casting the return value of ...

<Ib1ON.491729$vFZa.244143@fx13.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34886&group=comp.lang.c#34886

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.swapon.de!news.mixmin.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!193.141.40.65.MISMATCH!npeer.as286.net!npeer-ng0.as286.net!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx13.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Casting the return value of ...
Newsgroups: comp.lang.c
References: <uu416t$33u55$1@news.xmission.com> <20240328105203.773@kylheku.com> <K0jNN.158579$zF_1.100106@fx18.iad> <86le5zipzo.fsf@linuxsc.com> <OKZNN.587350$PuZ9.175960@fx11.iad> <uua5ra$18vsh$1@dont-email.me>
Lines: 14
Message-ID: <Ib1ON.491729$vFZa.244143@fx13.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sat, 30 Mar 2024 23:25:28 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sat, 30 Mar 2024 23:25:28 GMT
X-Received-Bytes: 1342
 by: Scott Lurndal - Sat, 30 Mar 2024 23:25 UTC

Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>On Sat, 30 Mar 2024 19:29:50 GMT, Scott Lurndal wrote:
>
>> We write production code not standard C (or in this
>> case, C++) code. Portability to compilers other than gcc is
>> not a requirement for the several million line codebase.
>
>Interesting. Has GCC become the de-facto-standard C compiler?

I'm not sure how you derived that conclusion from a single
proprietary project description.

Our target is linux. gcc is more than sufficient for the
task.

Re: Casting the return value of ...

<uubpb0$1qgfe$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34890&group=comp.lang.c#34890

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Casting the return value of ...
Date: Sun, 31 Mar 2024 15:44:00 +0200
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <uubpb0$1qgfe$1@dont-email.me>
References: <uu416t$33u55$1@news.xmission.com>
<20240328105203.773@kylheku.com> <K0jNN.158579$zF_1.100106@fx18.iad>
<86le5zipzo.fsf@linuxsc.com> <OKZNN.587350$PuZ9.175960@fx11.iad>
<uua5ra$18vsh$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 31 Mar 2024 13:44:01 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="5793f500a79ea8eab693b17a4819ce5c";
logging-data="1917422"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19wXP9H95yWfG4atRVHoaQuedze1BK0ius="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:wpazSmmDl+aDiMWCK+ME2y4Dr/Q=
In-Reply-To: <uua5ra$18vsh$1@dont-email.me>
Content-Language: en-GB
 by: David Brown - Sun, 31 Mar 2024 13:44 UTC

On 31/03/2024 00:05, Lawrence D'Oliveiro wrote:
> On Sat, 30 Mar 2024 19:29:50 GMT, Scott Lurndal wrote:
>
>> We write production code not standard C (or in this
>> case, C++) code. Portability to compilers other than gcc is
>> not a requirement for the several million line codebase.
>
> Interesting. Has GCC become the de-facto-standard C compiler?

gcc is the most commonly used compiler on Linux and in embedded systems.
It is not the most common on Windows, AFAIK - that honour goes to
MSVC. A number of gcc extensions, practices and flags have been copied
by other compilers (such as clang, icc, and others). A number of
features that started off as gcc extensions ended up in the C standards
- more, I think, than for extensions of any other compiler.

If you consider that to mean gcc is the "de-facto-standard C compiler",
that's up to you - it is not the standard C compiler in the context of
comp.lang.c, where "standard" refers to the C standards, since there is
no C standard reference compiler. But the term "de-facto standard" is
so vague and poorly defined that you can use it any way you like,
without conveying any useful information.

I can't speak for Scott, but in my work I happily use gcc extensions
(though I don't use them when standard C does as good a job). I don't
do that because it is a "de-facto standard" or anything of the sort - I
use gcc extensions when they let me write better code or give better
results, since my code does not normally have to be portable to other
compilers. If I happen to be working on a project that uses a different
compiler, I'll happily use extensions for that compiler too.

Re: Casting the return value of ...

<uucg99$1vucq$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34895&group=comp.lang.c#34895

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c
Subject: Re: Casting the return value of ...
Date: Sun, 31 Mar 2024 13:15:37 -0700
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <uucg99$1vucq$2@dont-email.me>
References: <uu416t$33u55$1@news.xmission.com>
<20240328105203.773@kylheku.com> <K0jNN.158579$zF_1.100106@fx18.iad>
<86le5zipzo.fsf@linuxsc.com> <OKZNN.587350$PuZ9.175960@fx11.iad>
<uua5ra$18vsh$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 31 Mar 2024 20:15:37 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="08ef37f04c264ba6cec9989a4cda6b29";
logging-data="2095514"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/K9X2xl+K2ZVHGhoSw5pOVaDznjwPxGkU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:8kpef7f3berdce8IGGLSpkHpOpE=
Content-Language: en-US
In-Reply-To: <uua5ra$18vsh$1@dont-email.me>
 by: Chris M. Thomasson - Sun, 31 Mar 2024 20:15 UTC

On 3/30/2024 4:05 PM, Lawrence D'Oliveiro wrote:
> On Sat, 30 Mar 2024 19:29:50 GMT, Scott Lurndal wrote:
>
>> We write production code not standard C (or in this
>> case, C++) code. Portability to compilers other than gcc is
>> not a requirement for the several million line codebase.
>
> Interesting. Has GCC become the de-facto-standard C compiler?

I don't think so.

Re: Casting the return value of ...

<86frvv2hxu.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34982&group=comp.lang.c#34982

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: Casting the return value of ...
Date: Mon, 08 Apr 2024 23:01:17 -0700
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <86frvv2hxu.fsf@linuxsc.com>
References: <uu416t$33u55$1@news.xmission.com> <20240328105203.773@kylheku.com> <K0jNN.158579$zF_1.100106@fx18.iad> <86le5zipzo.fsf@linuxsc.com> <OKZNN.587350$PuZ9.175960@fx11.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Tue, 09 Apr 2024 06:01:20 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="47558c70f7e061adbec47d824d7ff660";
logging-data="71395"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19h4afvaD42RTj4pNrKBKtItdl7oGAyGfg="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:athRc7eP2bk52rtmpq2o95Lgpis=
sha1:XI1sochqFkBtZc2y/Fsn4TlzqP8=
 by: Tim Rentsch - Tue, 9 Apr 2024 06:01 UTC

scott@slp53.sl.home (Scott Lurndal) writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>
>> scott@slp53.sl.home (Scott Lurndal) writes:
>>
>>> Kaz Kylheku <433-929-6894@kylheku.com> writes:
>>>
>>>> On 2024-03-28, Kenny McCormack <gazelle@shell.xmission.com> wrote:
>>>
>>> * Each shared object that simulates a Data Link Processor (DLP),
>>> * will contain a single namespace-scope function <b>get_dlp</b>
>>> * which constructs a DLP object of the specified type (for example,
>>> * a #c_uniline_dlp, #c_card_reader_dlp, et alia). <b>get_dlp</b>
>>> * returns the constructed object as a #c_dlp object to the #channel
>>> * function, which is then used by the I/O subsystem to request
>>> * services of the DLP at the MLI level.
>>> */
>>> typedef c_dlp* (*get_dlp_t)(const char *, uint64_t, c_logger *);
>>> ...
>>> get_dlp_t sym;
>>> ...
>>>
>>> sym = (get_dlp_t)dlsym(handle, "get_dlp");
>>> if (sym == NULL) {
>>> lp->log("Invalid DLP shared object format: %s\n", dlerror());
>>> unregister_handle(channel);
>>> dlclose(handle);
>>> return 1;
>>> }
>>>
>>>
>>>> I think there was a time in the development of GCC when there was
>>>> a warning even with the cast. I don't think it's enabled by default
>>>> now?
>>>
>>> We compile with -Wall -Werror and have never seen any warnings related
>>> to casting the result of dlsym(), and we build with GCC[4..13].
>>
>> Do you use -pedantic? Compiling with -pedantic using gcc 8.4.0
>> gives a warning diagnostic (and a fatal error if -pedantic-errors
>> is specified in place of -pedantic).
>
> Of course not. We write production code not standard C (or in this
> case, C++) code. Portability to compilers other than gcc is
> not a requirement for the several million line codebase.

It's quite amusing to hear of a team that insists on -Wall but
avoids -pedantic, saving a tiny drizzle of cases (all of which
are easy to remedy) while enduring the ever-changing force 5
blizzard of conditions tested by -Wall.

Re: Casting the return value of ...

<86bk6j2g2c.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34983&group=comp.lang.c#34983

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: Casting the return value of ...
Date: Mon, 08 Apr 2024 23:41:47 -0700
Organization: A noiseless patient Spider
Lines: 55
Message-ID: <86bk6j2g2c.fsf@linuxsc.com>
References: <uu416t$33u55$1@news.xmission.com> <20240328105203.773@kylheku.com> <87frwatadu.fsf@nosuchdomain.example.com> <uu4k1c$3pq71$1@dont-email.me> <uu6dtk$a076$1@dont-email.me> <uu6fss$agvi$1@dont-email.me> <86plvchxpn.fsf@linuxsc.com> <uu8s6n$v2o8$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Tue, 09 Apr 2024 06:41:49 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="47558c70f7e061adbec47d824d7ff660";
logging-data="88023"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX194CHAZSSRHGz+n3C9478kPw9PxNVPiAaU="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:zIGnplwEL06x1AUWxRXpuOV6ulM=
sha1:tU7U5QzcVCBpSzORID9ZZUKn+EM=
 by: Tim Rentsch - Tue, 9 Apr 2024 06:41 UTC

bart <bc@freeuk.com> writes:

> On 30/03/2024 09:32, Tim Rentsch wrote:
>
>> bart <bc@freeuk.com> writes:
>>
>>> I was aware of the double conversion but KT used 'a cast' so I
>>> wondered if there was a single cast that could be used.
>>
>> There is not, if it's important that it work reliably across
>> different compilers and different platforms.
>>
>>> It is odd however that function and object pointers can be
>>> considered so different that even an explicit conversion
>>> between them is deemed to be meaningless.
>>
>> Function pointers and object pointers don't have to be the same
>> size, or use the same form of representation. The C standard
>> allows implementations where code and data live in completely
>> separate memories. In such cases there is no sensible way to
>> convert between the two kinds of pointers, because the two kinds
>> of addresses have no relationship to each other.
>
> Suppose a object pointer is 32 bits, and a function pointer is a
> 32-byte descriptor.
>
> An implementation could choose to present a function pointer as a
> 32-bit object pointer, which points to the full 32-byte descriptor in
> data memory.
>
> The simplest way of doing that is to have, for each function (or each
> one whose address is taken), a fixed corresponding descriptor in data
> memory. So here function and object pointers can be exactly the same
> size, and can both refer to data memory, as far as the programmer is
> concerned.
>
> Dereferencing such a function pointer, to call the function, will
> involve an extra bit of indirection. It would need something extra
> anyway to deal with those 32 bytes.

Two problems. One, even if the proposed scheme is workable in some
cases that doesn't mean it will be in all cases. Two, it imposes
what may be a significant cost but offers essentially no benefit.
The only useful thing that can be done with a converted function
pointer is cast it to an appropriate function pointer type so that
the function can be called. If someone wants to have values and
variables that can hold both object pointers and function pointers
it is easy enough to do that by using a union:

typedef union { void *pv; void (*pf)(); } VorF;

with no hidden implementation machinery needed. There is no good
reason to gussy up the language or have implementations jump
through hoops when the needed capability is already present in
the language as it is now (and has been for more than 30 years).

Re: Casting the return value of ...

<uv2sos$3o6o$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34985&group=comp.lang.c#34985

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Casting the return value of ...
Date: Tue, 9 Apr 2024 10:03:40 +0200
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <uv2sos$3o6o$1@dont-email.me>
References: <uu416t$33u55$1@news.xmission.com>
<20240328105203.773@kylheku.com> <K0jNN.158579$zF_1.100106@fx18.iad>
<86le5zipzo.fsf@linuxsc.com> <OKZNN.587350$PuZ9.175960@fx11.iad>
<86frvv2hxu.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 09 Apr 2024 08:03:41 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="17bc22c42028aca8876adaf53505a968";
logging-data="123096"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/UXZeOmlZnoFX/2hpNYnyFXKzMgJIiNHc="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:wXF5IEM1EIm89qgNhWmQzoSKRfM=
In-Reply-To: <86frvv2hxu.fsf@linuxsc.com>
Content-Language: en-GB
 by: David Brown - Tue, 9 Apr 2024 08:03 UTC

On 09/04/2024 08:01, Tim Rentsch wrote:
> scott@slp53.sl.home (Scott Lurndal) writes:
>
>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>
>>> scott@slp53.sl.home (Scott Lurndal) writes:

>>>> We compile with -Wall -Werror and have never seen any warnings related
>>>> to casting the result of dlsym(), and we build with GCC[4..13].
>>>
>>> Do you use -pedantic? Compiling with -pedantic using gcc 8.4.0
>>> gives a warning diagnostic (and a fatal error if -pedantic-errors
>>> is specified in place of -pedantic).
>>
>> Of course not. We write production code not standard C (or in this
>> case, C++) code. Portability to compilers other than gcc is
>> not a requirement for the several million line codebase.
>
> It's quite amusing to hear of a team that insists on -Wall but
> avoids -pedantic, saving a tiny drizzle of cases (all of which
> are easy to remedy) while enduring the ever-changing force 5
> blizzard of conditions tested by -Wall.

I guess that's because his team writes real-world code using real-world
tools, rather than living in some sort of fantasy realm or ivory tower.

gcc's -Wall does not change much from version to version, and not
without a lot of debate and consideration. A new warning does not get
added to -Wall unless there is strong confidence and agreement that it
will have a very low rate of false positives, and the things it catches
have a high rate of being real problems (not just stylistic choices).
And part of the beta test procedure involves complete rebuilds of the
entire Debian and Red Hat source bases - many packages would fail to
build if changes to -Wall triggered new warnings.

And most real-world C programs are not strictly limited to fully
portable standard C. If portability is not an issue, then compiler
extensions give you a better language - better error checking, more
efficient results, easier coding, clearer coding, and of course features
that are tied to the target platform. "-pedantic" is not helpful for
such code.

Of course there are also people whose C coding must be strictly
according to the standards, and there are endless other variants in how
people use the language, tools and flags. But I expect the use of
"-Wall" without "-Wpedantic" to be very much more common than the opposite.

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor