Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #384222

Re: Casting the return value of ...

From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c
Subject Re: Casting the return value of ...
Date 2024-04-08 23:01 -0700
Organization A noiseless patient Spider
Message-ID <86frvv2hxu.fsf@linuxsc.com> (permalink)
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>

Show all headers | View raw


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.

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Casting the return value of ... gazelle@shell.xmission.com (Kenny McCormack) - 2024-03-28 15:09 +0000
  Re: Casting the return value of ... Kaz Kylheku <433-929-6894@kylheku.com> - 2024-03-28 18:16 +0000
    Re: Casting the return value of ... scott@slp53.sl.home (Scott Lurndal) - 2024-03-28 18:53 +0000
      Re: Casting the return value of ... Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-03-30 10:33 -0700
        Re: Casting the return value of ... scott@slp53.sl.home (Scott Lurndal) - 2024-03-30 19:29 +0000
          Re: Casting the return value of ... Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-30 23:05 +0000
            Re: Casting the return value of ... scott@slp53.sl.home (Scott Lurndal) - 2024-03-30 23:25 +0000
            Re: Casting the return value of ... David Brown <david.brown@hesbynett.no> - 2024-03-31 15:44 +0200
            Re: Casting the return value of ... "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-31 13:15 -0700
          Re: Casting the return value of ... Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-04-08 23:01 -0700
            Re: Casting the return value of ... David Brown <david.brown@hesbynett.no> - 2024-04-09 10:03 +0200
    Re: Casting the return value of ... Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-03-28 12:38 -0700
      Re: Casting the return value of ... bart <bc@freeuk.com> - 2024-03-28 20:30 +0000
        Re: Casting the return value of ... Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-03-28 14:07 -0700
          Re: Casting the return value of ... "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-28 14:15 -0700
          Re: Casting the return value of ... Kaz Kylheku <433-929-6894@kylheku.com> - 2024-03-28 21:44 +0000
            Re: Casting the return value of ... Kaz Kylheku <433-929-6894@kylheku.com> - 2024-03-28 22:01 +0000
              Re: Casting the return value of ... Kaz Kylheku <433-929-6894@kylheku.com> - 2024-03-28 22:33 +0000
                Re: Casting the return value of ... Michael S <already5chosen@yahoo.com> - 2024-03-29 15:53 +0200
                gcc Bugzilla search (was: Casting the return value of ...) Michael S <already5chosen@yahoo.com> - 2024-03-29 16:01 +0200
                Re: gcc Bugzilla search David Brown <david.brown@hesbynett.no> - 2024-03-29 17:00 +0100
            Re: Casting the return value of ... Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-03-28 15:37 -0700
          Re: Casting the return value of ... David Brown <david.brown@hesbynett.no> - 2024-03-29 14:06 +0100
            Re: Casting the return value of ... "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-29 15:46 -0700
        Re: Casting the return value of ... David Brown <david.brown@hesbynett.no> - 2024-03-29 13:58 +0100
          Re: Casting the return value of ... bart <bc@freeuk.com> - 2024-03-29 13:32 +0000
            Re: Casting the return value of ... David Brown <david.brown@hesbynett.no> - 2024-03-29 17:10 +0100
            Re: Casting the return value of ... Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-03-30 02:32 -0700
              Re: Casting the return value of ... bart <bc@freeuk.com> - 2024-03-30 11:14 +0000
                Re: Casting the return value of ... Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-04-08 23:41 -0700
  Re: Casting the return value of ... Andrey Tarasevich <andreytarasevich@hotmail.com> - 2024-03-28 21:41 -0700
    Re: Casting the return value of ... Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-03-28 22:02 -0700
  Re: Casting the return value of ... Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-03-29 15:52 -0700

csiph-web