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


Groups > comp.lang.c++ > #92497

Re: “ChattyG takes a college freshman C/C++ programming exam”

Path csiph.com!news.mixmin.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c++, comp.lang.c
Subject Re: “ChattyG takes a college freshman C/C++ programming exam”
Date Mon, 09 Oct 2023 17:15:04 -0700
Organization None to speak of
Lines 42
Message-ID <87zg0rtjsn.fsf@nosuchdomain.example.com> (permalink)
References <ufne0r$15ple$1@dont-email.me> <20231007235448.25c4986f123c88ff65d2f103@gmail.moc> <uftmh9$2vieq$1@dont-email.me> <20231008125543.518cab44cdefed7e8af393c8@gmail.moc> <pan$93d59$b5109882$fbf405c8$d4bea16f@invalid.invalid> <87cyxovj92.fsf@nosuchdomain.example.com> <20231009230651.433f6ac34e4597e3b015f019@gmail.moc>
MIME-Version 1.0
Content-Type text/plain
Injection-Info dont-email.me; posting-host="22bf231b5b8ebc319b1c8a1413823473"; logging-data="222368"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+UlREb9QUXse1oJEPBHZUs"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock sha1:67b8lUUXcbJvzZ4LAVB1o1yRA6Q= sha1:w7JWOJz5aZnKN1KBxt9LT/X88G4=
Xref csiph.com comp.lang.c++:92497 comp.lang.c:198374

Cross-posted to 2 groups.

Show key headers only | View raw


Anton Shepelev <anton.txt@gmail.moc> writes:
> Keith Thompson to Blue-Maned_Hawk:
>> > The return value from dlsym(), cast to a pointer to the
>> > type of the named symbol, can be used to call (in the
>> > case of a function) or access the contents of (in the
>> > case of a data object) the named symbol.
>>
>> An implementation could satisfy that requirement without
>> supporting void* to function pointer conversions in
>> general.
>
> Sounds a like an unnecessary special case and a loophole,
> when a standard solution exists:
>
>    Message-ID: <20231009230305.adfd0d80c146dc966ab22443@gmail.moc>
>    Archived  : http://al.howardknight.net/?ID=169688196000

dlsym() *is* a standard solution.  It's specified by the POSIX standard,
which imposes some additional requirements on top of those imposed by
the ISO C standard.  For example, a conforming C implementation with
16-bit int cannot conform to POSIX, which requires INT_MAX >= 2147483647.

My remark about an implementation using special-case code to narrowly
support dlsym() was mostly theoretical.  I doubt that any real-world
system exists which supports POSIX on which converting a function
pointer to void* and back again doesn't yield a valid copy of the
original function pointer.

I agree that it would have been cleaner if POSIX had specified two
different dlsym() functions, one for objects and one for functions.

Another post in this thread suggests that dlsym() originated with SunOS,
some time around 1990.  That was after C90 was published, but I can
imagine that it or something like it was introduced earlier.

The current dlsym() specification is a bit sloppy, but as far as I can
tell that hasn't created any problems in practice.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

“ChattyG takes a college freshman C/C++ programming exam” Lynn McGuire <lynnmcguire5@gmail.com> - 2023-10-05 17:40 -0500
  Re: “ChattyG takes a college freshman C/C++ programming exam” "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-05 15:57 -0700
  Re: “ChattyG takes a college freshman C/C++ programming exam” Christian Gollwitzer <auriocus@gmx.de> - 2023-10-06 07:36 +0200
    Re: “ChattyG takes a college freshman C/C++ programming exam” "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-06 11:59 -0700
  Re: “ChattyG takes a college freshman C/C++ programming exam” Anton Shepelev <anton.txt@gmail.moc> - 2023-10-07 23:54 +0300
    Re: “ChattyG takes a college freshman C/C++ programming exam” jak <nospam@please.ty> - 2023-10-08 09:42 +0200
      Re: “ChattyG takes a college freshman C/C++ programming exam” James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-10-08 04:27 -0400
      Re: “ChattyG takes a college freshman C/C++ programming exam” Anton Shepelev <anton.txt@gmail.moc> - 2023-10-08 12:55 +0300
        Re: “ChattyG takes a college freshman C/C++ programming exam” Anton Shepelev <anton.txt@gmail.moc> - 2023-10-08 13:06 +0300
        Re: “ChattyG takes a college freshman C/C++ programming exam” candycanearter07 <no@thanks.net> - 2023-10-08 06:22 -0500
          Re: “ChattyG takes a college freshman C/C++ programming exam” Anton Shepelev <anton.txt@gmail.moc> - 2023-10-08 15:03 +0300
            Re: “ChattyG takes a college freshman C/C++ programming exam” Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2023-10-15 15:51 -0400
              Re: “ChattyG takes a college freshman C/C++ programming exam” Richard Damon <richard@damon-family.org> - 2023-10-15 17:53 -0400
              Re: “ChattyG takes a college freshman C/C++ programming exam” James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-10-16 00:07 -0400
                Re: “ChattyG takes a college freshman C/C++ programming exam” Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2023-10-16 22:01 -0400
                Re: “ChattyG takes a college freshman C/C++ programming exam” Richard Damon <richard@damon-family.org> - 2023-10-16 22:41 -0400
                Re: “ChattyG takes a college freshman C/C++ programming exam” James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-10-17 12:22 -0400
          Re: “ChattyG takes a college freshman C/C++ programming exam” "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-08 12:31 -0700
            Re: “ChattyG takes a college freshman C/C++ programming exam” Richard Damon <news.x.richarddamon@xoxy.net> - 2023-10-08 21:17 -0400
              Re: “ChattyG takes a college freshman C/C++ programming exam” James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-10-09 01:13 -0400
                Re: “ChattyG takes a college freshman C/C++ programming exam” "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-10 12:18 -0700
            Re: “ChattyG takes a college freshman C/C++ programming exam” MarioCCCP <NoliMihiFrangereMentulam@libero.it> - 2023-10-13 11:22 +0200
              Re: “ChattyG takes a college freshman C/C++ programming exam” Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-10-13 10:04 -0700
        Re: “ChattyG takes a college freshman C/C++ programming exam” Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-10-08 13:54 +0100
        Re: “ChattyG takes a college freshman C/C++ programming exam” James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-10-08 11:25 -0400
          Re: “ChattyG takes a college freshman C/C++ programming exam” Anton Shepelev <anton.txt@gmail.moc> - 2023-10-08 20:07 +0300
        Re: “ChattyG takes a college freshman C/C++ programming exam” Blue-Maned_Hawk <bluemanedhawk@invalid.invalid> - 2023-10-08 16:37 +0000
          Re: “ChattyG takes a college freshman C/C++ programming exam” Anton Shepelev <anton.txt@gmail.moc> - 2023-10-08 20:05 +0300
            Re: “ChattyG takes a college freshman C/C++ programming exam” James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-10-09 01:13 -0400
              Re: “ChattyG takes a college freshman C/C++ programming exam” "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-09 13:30 -0700
                Re: Re: “ChattyG takes a college freshman C/C++ programming exam” scott@slp53.sl.home (Scott Lurndal) - 2023-10-09 20:33 +0000
                Re: “ChattyG takes a college freshman C/C++ programming exam” "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-10 12:04 -0700
            Re: “ChattyG takes a college freshman C/C++ programming exam” Blue-Maned_Hawk <bluemanedhawk@invalid.invalid> - 2023-10-09 12:17 +0000
              Re: “ChattyG takes a college freshman C/C++ programming exam” Anton Shepelev <anton.txt@gmail.moc> - 2023-10-09 23:03 +0300
                Re: “ChattyG takes a college freshman C/C++ programming exam” scott@slp53.sl.home (Scott Lurndal) - 2023-10-09 20:30 +0000
                Re: “ChattyG takes a college freshman C/C++ programming exam” Anton Shepelev <anton.txt@gmail.moc> - 2023-10-09 23:45 +0300
                Re: “ChattyG takes a college freshman C/C++ programming exam” scott@slp53.sl.home (Scott Lurndal) - 2023-10-09 21:21 +0000
                Re: “ChattyG takes a college freshman C/C++ programming exam” scott@slp53.sl.home (Scott Lurndal) - 2023-10-09 21:26 +0000
                Re: “ChattyG takes a college freshman C/C++ programming exam” James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-10-09 22:41 -0400
                Re: “ChattyG takes a college freshman C/C++ programming exam” Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-10-09 21:47 +0100
          Re: “ChattyG takes a college freshman C/C++ programming exam” Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-10-08 15:31 -0700
            Re: “ChattyG takes a college freshman C/C++ programming exam” James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-10-09 01:12 -0400
              Re: “ChattyG takes a college freshman C/C++ programming exam” Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-10-10 18:46 -0700
                Re: “ChattyG takes a college freshman C/C++ programming exam” James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-10-11 01:14 -0400
                Re: “ChattyG takes a college freshman C/C++ programming exam” scott@slp53.sl.home (Scott Lurndal) - 2023-10-11 13:47 +0000
                Re: “ChattyG takes a college freshman C/C++ programming exam” Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-10-11 07:56 -0700
            Re: “ChattyG takes a college freshman C/C++ programming exam” Anton Shepelev <anton.txt@gmail.moc> - 2023-10-09 23:06 +0300
              Re: “ChattyG takes a college freshman C/C++ programming exam” Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-10-09 17:15 -0700
      Re: “ChattyG takes a college freshman C/C++ programming exam” James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-10-08 11:08 -0400
  Re: “ChattyG takes a college freshman C/C++ programming exam” "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-11 21:06 -0700
    Re: “ChattyG takes a college freshman C/C++ programming exam” "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-11 21:10 -0700
    Re: “ChattyG takes a college freshman C/C++ programming exam” Anton Shepelev <anton.txt@g{oogle}mail.com> - 2023-10-12 10:56 +0300
    Re: “ChattyG takes a college freshman C/C++ programming exam” Anton Shepelev <anton.txt@g{oogle}mail.com> - 2023-10-12 10:57 +0300
      Re: “ChattyG takes a college freshman C/C++ programming exam” "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-12 12:59 -0700
  Re: “ChattyG takes a college freshman C/C++ programming exam” Anton Shepelev <anton.txt@g{oogle}mail.com> - 2023-10-12 10:53 +0300
    Re: “ChattyG takes a college freshman C/C++ programming exam” Phil Carmody <pc+usenet@asdf.org> - 2023-10-23 15:39 +0300
      Re: “ChattyG takes a college freshman C/C++ programming exam” Anton Shepelev <anton.txt@g{oogle}mail.com> - 2023-10-23 16:45 +0300

csiph-web