Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Nuclear war would really set back cable." -- Ted Turner


devel / comp.lang.c++ / Re: Re: “ChattyG takes a college freshman C/C++ programming exam”

SubjectAuthor
* “ChattyG takes a college freshman C/C++ programmiLynn McGuire
+- Re: “ChattyG takes a college freshman C/C++ proChris M. Thomasson
+* Re: “ChattyG takes a college freshman C/C++ proChristian Gollwitzer
|`- Re: “ChattyG takes a college freshman C/C++ proChris M. Thomasson
+* Re: “ChattyG takes a college freshman C/C++Anton Shepelev
|`* Re: “ChattyG takes a college freshman C/C++ progrjak
| +- Re: “ChattyG takes a college freshman C/C++ proJames Kuyper
| +* Re: “ChattyG takes a college freshman C/C++Anton Shepelev
| |+- Re: “ChattyG takes a college freshman C/C++Anton Shepelev
| |+* Re: “ChattyG takes a college freshman C/C++ procandycanearter07
| ||+* Re: “ChattyG takes a college freshman C/C++Anton Shepelev
| |||`* Re: “ChattyG takes a college freshman C/C++ progrPavel
| ||| +- Re: “ChattyG takes a college freshman C/C++ proRichard Damon
| ||| `* Re: “ChattyG takes a college freshman C/C++ proJames Kuyper
| |||  `* Re: “ChattyG takes a college freshman C/C++ progrPavel
| |||   +- Re: “ChattyG takes a college freshman C/C++ proRichard Damon
| |||   `- Re: “ChattyG takes a college freshman C/C++ proJames Kuyper
| ||`* Re: “ChattyG takes a college freshman C/C++ proChris M. Thomasson
| || +* Re: “ChattyG takes a college freshman C/C++ proRichard Damon
| || |`* Re: “ChattyG takes a college freshman C/C++ proJames Kuyper
| || | `- Re: “ChattyG takes a college freshman C/C++ proChris M. Thomasson
| || `* Re: “ChattyG takes a college freshman C/C++ proMarioCCCP
| ||  `- Re: “ChattyG takes a college freshman C/C++Keith Thompson
| |+- Re: “ChattyG takes a college freshman C/C++Ben Bacarisse
| |+* Re: “ChattyG takes a college freshman C/C++ proJames Kuyper
| ||`- Re: “ChattyG takes a college freshman C/C++Anton Shepelev
| |`* Re: “ChattyG takes a college freshman C/C++Blue-Maned_Hawk
| | +* Re: “ChattyG takes a college freshman C/C++Anton Shepelev
| | |+* Re: “ChattyG takes a college freshman C/C++ proJames Kuyper
| | ||`* Re: “ChattyG takes a college freshman C/C++ proChris M. Thomasson
| | || `* Re: Re: “ChattyG takes a college freshman C/C++ programming exam”Scott Lurndal
| | ||  `- Re: “ChattyG takes a college freshman C/C++ proChris M. Thomasson
| | |`* Re: “ChattyG takes a college freshman C/C++Blue-Maned_Hawk
| | | `* Re: “ChattyG takes a college freshman C/C++Anton Shepelev
| | |  +* Re: “ChattyG takes a college freshman C/C++ programming exam”Scott Lurndal
| | |  |`* Re: “ChattyG takes a college freshman C/C++Anton Shepelev
| | |  | +- Re: “ChattyG takes a college freshman C/C++ programming exam”Scott Lurndal
| | |  | +- Re: “ChattyG takes a college freshman C/C++ programming exam”Scott Lurndal
| | |  | `- Re: “ChattyG takes a college freshman C/C++ proJames Kuyper
| | |  `- Re: “ChattyG takes a college freshman C/C++Ben Bacarisse
| | `* Re: “ChattyG takes a college freshman C/C++Keith Thompson
| |  +* Re: “ChattyG takes a college freshman C/C++ proJames Kuyper
| |  |`* Re: “ChattyG takes a college freshman C/C++Keith Thompson
| |  | +- Re: “ChattyG takes a college freshman C/C++ proJames Kuyper
| |  | +- Re: “ChattyG takes a college freshman C/C++ programming exam”Scott Lurndal
| |  | `- Re: “ChattyG takes a college freshman C/C++Tim Rentsch
| |  `* Re: “ChattyG takes a college freshman C/C++Anton Shepelev
| |   `- Re: “ChattyG takes a college freshman C/C++Keith Thompson
| `- Re: “ChattyG takes a college freshman C/C++ proJames Kuyper
+* Re: “ChattyG takes a college freshman C/C++ proChris M. Thomasson
|+- Re: “ChattyG takes a college freshman C/C++ proChris M. Thomasson
|+- Re: “ChattyG takes a college freshman C/C++Anton Shepelev
|`* Re: “ChattyG takes a college freshman C/C++Anton Shepelev
| `- Re: “ChattyG takes a college freshman C/C++ proChris M. Thomasson
`* Re: “ChattyG takes a college freshman C/C++Anton Shepelev
 `* Re: “ChattyG takes a college freshman C/C++Phil Carmody
  `* Re: “ChattyG takes a college freshman C/C++Anton Shepelev
   `- Re: “ChattyG takes a college freshman C/C++Phil Carmody

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

<20231009230651.433f6ac34e4597e3b015f019@gmail.moc>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton....@gmail.moc (Anton Shepelev)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: “ChattyG takes a college freshman C/C++
programming exam”
Date: Mon, 9 Oct 2023 23:06:51 +0300
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <20231009230651.433f6ac34e4597e3b015f019@gmail.moc>
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>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="404cc1cc3d5d5d1907a85a6573344343";
logging-data="119227"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/AaV94kG32FgSfPSIKB9ZliislYg4jJ6g="
Cancel-Lock: sha1:O2T1P6cEPitP1yiyHVqOiTK5Tg0=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
 by: Anton Shepelev - Mon, 9 Oct 2023 20:06 UTC

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

--
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments

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

<OpZUM.25106$0UVe.19441@fx17.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx17.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: “ChattyG takes a college freshman C/C++ programming exam”
Newsgroups: comp.lang.c++,comp.lang.c
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> <20231008200536.2aebe46b71bae8b879b5bddb@gmail.moc> <pan$da5cd$33b40da2$e72bf6b3$e30efcdc@invalid.invalid> <20231009230305.adfd0d80c146dc966ab22443@gmail.moc>
Lines: 38
Message-ID: <OpZUM.25106$0UVe.19441@fx17.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 09 Oct 2023 20:30:38 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 09 Oct 2023 20:30:38 GMT
X-Received-Bytes: 2587
 by: Scott Lurndal - Mon, 9 Oct 2023 20:30 UTC

Anton Shepelev <anton.txt@gmail.moc> writes:
>Blue-Maned_Hawk to Anton Shepelev:
>
>> > Blue-Maned_Hawk:
>> > [Unicode em-dash replaced with --]
>>
>> Why?
>
>Oh, it just doesn't go with Usenet, stylistically and
>aesthetically. English plain-text is must like
>code -- 7-bit-clean. And like code (e.g. for Troff or
>LaTeX), there are convensions for dashes, /italic/ text,
><URLs>, &c. Your signature is a mess of Unicode
>characters -- terrible :-!
>
>> > > It mayn't be supported in standard C, but it's a
>> > > common extension--in fact, POSIX _requires_ it in
>> > > order for the dlsym subroutine to work.
>> >
>> > How so, when casing the return value (from a different
>> > function pointer) does not solve the problem?
>>
>> I was not referring to functions returning pointers to
>> themselves in the quoted part of my message. I was
>> referring to void * being castable to a function pointer.
>
>Yes, and I asked why the authors of that API decided not to
>use the casing that is guarranteed to work, preferring the
>dubious casing of void* to function pointers.

Because all POSIX systems of the day had identically
sized function and object pointers, and the committee possibly
did not believe that there would ever be a future architecture
for which POSIX would be useful that had a distinction
between object and function pointers and they had little
interest in obsoleting existing code.

dlsym showed up about 1990 in SVR4, coming from SunOS IIRC.

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

<ug1nu0$3t1e$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!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:_“ChattyG_takes_a_college_freshman_C/C++_pro
gramming_exam”
Date: Mon, 9 Oct 2023 13:30:56 -0700
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <ug1nu0$3t1e$1@dont-email.me>
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>
<20231008200536.2aebe46b71bae8b879b5bddb@gmail.moc>
<ug0267$3lhhc$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 9 Oct 2023 20:30:57 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7a1c4b35f1f5df951a55bd5359f22742";
logging-data="128046"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/juOTeH8IzlnwCGLk1TUJkOejezvlzMuE="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:X5LyOBXQBXBCLwUTMLZdhRlomH8=
Content-Language: en-US
In-Reply-To: <ug0267$3lhhc$3@dont-email.me>
 by: Chris M. Thomasson - Mon, 9 Oct 2023 20:30 UTC

On 10/8/2023 10:13 PM, James Kuyper wrote:
> On 10/8/23 13:05, Anton Shepelev wrote:
>> Blue-Maned_Hawk:
>> [Unicode em-dash replaced with --]
>>> [functions returning pointers to themselves]
>>> It mayn't be supported in standard C, but it's a common
>>> extension--in fact, POSIX _requires_ it in order for the
>>> dlsym subroutine to work.
>>
>> How so, when casing the return value (from a different
>> function pointer) does not solve the problem?
>
> The problem is behavior that is not defined by the C standard. POSIX
> solves the problem by defining the behavior:
>
> "Note that conversion from a void * pointer to a function pointer as in:
>
> fptr = (int (*)(int))dlsym(handle, "my_function");
>
> is not defined by the ISO C standard. This standard requires this
> conversion to work correctly on conforming implementations."
>
> "This standard" refers to the POSIX standard, not the C standard.
>

That about sums it all up. POSIX does not equal the C/C++ standards. If
a system and one of its C compilers claims support for POSIX, well so be it.

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

<zsZUM.25107$0UVe.18512@fx17.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!news.niel.me!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx17.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: Re:_“ChattyG_takes_a_college_freshman_C/C++_programming_exam”
Newsgroups: comp.lang.c++
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> <20231008200536.2aebe46b71bae8b879b5bddb@gmail.moc> <ug0267$3lhhc$3@dont-email.me> <ug1nu0$3t1e$1@dont-email.me>
Lines: 31
Message-ID: <zsZUM.25107$0UVe.18512@fx17.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 09 Oct 2023 20:33:35 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 09 Oct 2023 20:33:35 GMT
X-Received-Bytes: 2327
 by: Scott Lurndal - Mon, 9 Oct 2023 20:33 UTC

"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>On 10/8/2023 10:13 PM, James Kuyper wrote:
>> On 10/8/23 13:05, Anton Shepelev wrote:
>>> Blue-Maned_Hawk:
>>> [Unicode em-dash replaced with --]
>>>> [functions returning pointers to themselves]
>>>> It mayn't be supported in standard C, but it's a common
>>>> extension--in fact, POSIX _requires_ it in order for the
>>>> dlsym subroutine to work.
>>>
>>> How so, when casing the return value (from a different
>>> function pointer) does not solve the problem?
>>
>> The problem is behavior that is not defined by the C standard. POSIX
>> solves the problem by defining the behavior:
>>
>> "Note that conversion from a void * pointer to a function pointer as in:
>>
>> fptr = (int (*)(int))dlsym(handle, "my_function");
>>
>> is not defined by the ISO C standard. This standard requires this
>> conversion to work correctly on conforming implementations."
>>
>> "This standard" refers to the POSIX standard, not the C standard.
>>
>
>That about sums it all up. POSIX does not equal the C/C++ standards. If
>a system and one of its C compilers claims support for POSIX, well so be it.

If you're using dlsym in your application, you are unlikely to be using
a non-POSIX system in the first place.

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

<20231009234509.8c1887fd8b98e4db058726c5@gmail.moc>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton....@gmail.moc (Anton Shepelev)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: “ChattyG takes a college freshman C/C++
programming exam”
Date: Mon, 9 Oct 2023 23:45:09 +0300
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <20231009234509.8c1887fd8b98e4db058726c5@gmail.moc>
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>
<20231008200536.2aebe46b71bae8b879b5bddb@gmail.moc>
<pan$da5cd$33b40da2$e72bf6b3$e30efcdc@invalid.invalid>
<20231009230305.adfd0d80c146dc966ab22443@gmail.moc>
<OpZUM.25106$0UVe.19441@fx17.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="404cc1cc3d5d5d1907a85a6573344343";
logging-data="138285"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19lSeHBjJbgSuSHd2jPu+QqNuzhp0AVeoM="
Cancel-Lock: sha1:oaReifS4IOdSyWSPKk8AfV79Rq8=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
 by: Anton Shepelev - Mon, 9 Oct 2023 20:45 UTC

Scott Lurndal to Anton Shepelev:

> > Yes, and I asked why the authors of that API decided not
> > to use the casing that is guarranteed to work,
> > preferring the dubious casing of void* to function
> > pointers.
>
> Because all POSIX systems of the day had identically sized
> function and object pointers, and the committee possibly
> did not believe that there would ever be a future
> architecture for which POSIX would be useful that had a
> distinction between object and function pointers

Sounds like a instance myopic thinking. Compliance with the
Standard is always the safest road into the future. ("Write
it down in your notebooks, gentlemen!"[1])

> and they had little interest in obsoleting existing code.
>
> dlsym showed up about 1990 in SVR4, coming from SunOS
> IIRC.

What was there to obsolete in 1990, or did you mean ever
since?
____________________
1. /One-storied America/

--
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments

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

<878r8b7cb8.fsf@bsb.me.uk>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!news.swapon.de!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: “ChattyG takes a college freshman C/C++
programming exam”
Date: Mon, 09 Oct 2023 21:47:39 +0100
Organization: A noiseless patient Spider
Lines: 61
Message-ID: <878r8b7cb8.fsf@bsb.me.uk>
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>
<20231008200536.2aebe46b71bae8b879b5bddb@gmail.moc>
<pan$da5cd$33b40da2$e72bf6b3$e30efcdc@invalid.invalid>
<20231009230305.adfd0d80c146dc966ab22443@gmail.moc>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="39501676898f3c17ed4e55effbe9740e";
logging-data="139256"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Mxe8UqOXC6zS9RS3K/Ihf2su5xIUw0fo="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:/wuSAXkjy41sOBcPycotZAQdmlQ=
sha1:ENnaYK4QwcTI9r71w8RshO2I74g=
X-BSB-Auth: 1.4e065a5fd48fb0180d82.20231009214739BST.878r8b7cb8.fsf@bsb.me.uk
 by: Ben Bacarisse - Mon, 9 Oct 2023 20:47 UTC

Anton Shepelev <anton.txt@gmail.moc> writes:

> Blue-Maned_Hawk to Anton Shepelev:
>
>> > Blue-Maned_Hawk:
>> > [Unicode em-dash replaced with --]
>>
>> Why?
>
> Oh, it just doesn't go with Usenet, stylistically and
> aesthetically.

What is aesthetically wrong about using a bullet-point marker? What
is stylistically wrong about writing accented characters?

> English plain-text is much like
> code -- 7-bit-clean.

That's circular. By "plain-text" you mean 7-bit clean. Texts written
in English have, traditionally, used all sort of typographical marks,
and it has always been considered goof style to write correctly.
Phonetic script should be rendered correctly. Foreign words should be
rendered correctly.

What many people think of a "plain" English text is just what we've been
forced to write by clunky technology; first typewriters and then
computers. We should more on. There was a time when people would moan
if I sent a file with lower case letters in it because it could not be
rendered on a CDC mainframe. Come on, it's the 21st century.

> And like code (e.g. for Troff or
> LaTeX), there are convensions for dashes, /italic/ text,
> <URLs>, &c. Your signature is a mess of Unicode
> characters -- terrible :-!

BMH has posted a bad signature. It's not UTF-8 encoded Unicode at all,
despite what the header says. It is what's called mojibake.

In fact, properly rendered, his sig just contains a few phonetic letters
and, oddly, some "BOX DRAWINGS LIGHT VERTICAL" lines for which I would
have used | (despite what I wrote above).

Of course the fact that he did not post it correctly could be seen as
undermining my case, but I take as a further call to action: come on
BMH, buck up and get it right!

>> I was not referring to functions returning pointers to
>> themselves in the quoted part of my message. I was
>> referring to void * being castable to a function pointer.
>
> Yes, and I asked why the authors of that API decided not to
> use the casing that is guarranteed to work, preferring the
> dubious casing of void* to function pointers.

Almost certainly a case that the designers knew the system involved and
were solving an immediate problem for one particular OS on a limited
class of machines (SunOS, I think). They never thought that people
would still be using it, much less critiquing it, 40 years later!

--
Ben.

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

<99_UM.42356$tnmf.7102@fx09.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx09.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: “ChattyG takes a college freshman C/C++ programming exam”
Newsgroups: comp.lang.c++,comp.lang.c
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> <20231008200536.2aebe46b71bae8b879b5bddb@gmail.moc> <pan$da5cd$33b40da2$e72bf6b3$e30efcdc@invalid.invalid> <20231009230305.adfd0d80c146dc966ab22443@gmail.moc> <OpZUM.25106$0UVe.19441@fx17.iad> <20231009234509.8c1887fd8b98e4db058726c5@gmail.moc>
Lines: 42
Message-ID: <99_UM.42356$tnmf.7102@fx09.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 09 Oct 2023 21:21:09 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 09 Oct 2023 21:21:09 GMT
X-Received-Bytes: 2679
 by: Scott Lurndal - Mon, 9 Oct 2023 21:21 UTC

Anton Shepelev <anton.txt@gmail.moc> writes:
>Scott Lurndal to Anton Shepelev:
>
>> > Yes, and I asked why the authors of that API decided not
>> > to use the casing that is guarranteed to work,
>> > preferring the dubious casing of void* to function
>> > pointers.
>>
>> Because all POSIX systems of the day had identically sized
>> function and object pointers, and the committee possibly
>> did not believe that there would ever be a future
>> architecture for which POSIX would be useful that had a
>> distinction between object and function pointers
>
>Sounds like a instance myopic thinking. Compliance with the
>Standard is always the safest road into the future. ("Write
>it down in your notebooks, gentlemen!"[1])

The POSIX standard had been successful in supporting a
portability ecosystem spanning a wide range of
implementations.

Are you aware of any extant implementations for which
the POSIX dlsym requirement doesn't hold?

>
>> and they had little interest in obsoleting existing code.
>>
>> dlsym showed up about 1990 in SVR4, coming from SunOS
>> IIRC.
>
>What was there to obsolete in 1990, or did you mean ever
>since?

There were no dynamically loaded libraries in system V
before SVR4. There was a limited form of shared library
in SVR3 where the memory for the library would be shared
by multiple processes - each library was linked at a
different physical address and was loaded into that
range. Quite unwieldy and limited and replaced by
the ELF-based dynamic linking inherited from SunOS
when SUN and USL were developing SVr4.

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

<De_UM.42357$tnmf.34521@fx09.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx09.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: “ChattyG takes a college freshman C/C++ programming exam”
Newsgroups: comp.lang.c++,comp.lang.c
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> <20231008200536.2aebe46b71bae8b879b5bddb@gmail.moc> <pan$da5cd$33b40da2$e72bf6b3$e30efcdc@invalid.invalid> <20231009230305.adfd0d80c146dc966ab22443@gmail.moc> <OpZUM.25106$0UVe.19441@fx17.iad> <20231009234509.8c1887fd8b98e4db058726c5@gmail.moc>
Lines: 30
Message-ID: <De_UM.42357$tnmf.34521@fx09.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 09 Oct 2023 21:26:59 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 09 Oct 2023 21:26:59 GMT
X-Received-Bytes: 2189
 by: Scott Lurndal - Mon, 9 Oct 2023 21:26 UTC

Anton Shepelev <anton.txt@gmail.moc> writes:
>Scott Lurndal to Anton Shepelev:
>
>> > Yes, and I asked why the authors of that API decided not
>> > to use the casing that is guarranteed to work,
>> > preferring the dubious casing of void* to function
>> > pointers.
>>
>> Because all POSIX systems of the day had identically sized
>> function and object pointers, and the committee possibly
>> did not believe that there would ever be a future
>> architecture for which POSIX would be useful that had a
>> distinction between object and function pointers
>
>Sounds like a instance myopic thinking. Compliance with the
>Standard is always the safest road into the future. ("Write
>it down in your notebooks, gentlemen!"[1])
>
>> and they had little interest in obsoleting existing code.
>>
>> dlsym showed up about 1990 in SVR4, coming from SunOS
>> IIRC.
>
>What was there to obsolete in 1990, or did you mean ever
>since?

The dlsym() interface was added to the SuS in issue 5, call it late 90's.

It was not part of SVID Issue 3 (1989) which formalized the
API changes in SVR4.

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

<87zg0rtjsn.fsf@nosuchdomain.example.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
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>
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=
 by: Keith Thompson - Tue, 10 Oct 2023 00:15 UTC

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 */

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

<ug2dk3$bss1$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c++
Subject: Re:_“ChattyG_takes_a_college_freshman_C/C++_pro
gramming_exam”
Date: Mon, 9 Oct 2023 22:41:07 -0400
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <ug2dk3$bss1$1@dont-email.me>
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>
<20231008200536.2aebe46b71bae8b879b5bddb@gmail.moc>
<pan$da5cd$33b40da2$e72bf6b3$e30efcdc@invalid.invalid>
<20231009230305.adfd0d80c146dc966ab22443@gmail.moc>
<OpZUM.25106$0UVe.19441@fx17.iad>
<20231009234509.8c1887fd8b98e4db058726c5@gmail.moc>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 10 Oct 2023 02:41:15 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6cdab499c3301c78a112af6bee10dbde";
logging-data="390017"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19hj1uqm3Wbr5TQR+NFGQcZzgaNllTul+s="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:4HFanhGFyPknmUhKEYfaXMv/Xi4=
In-Reply-To: <20231009234509.8c1887fd8b98e4db058726c5@gmail.moc>
Content-Language: en-US
 by: James Kuyper - Tue, 10 Oct 2023 02:41 UTC

On 10/9/23 16:45, Anton Shepelev wrote:
> Scott Lurndal to Anton Shepelev:
>
>>> Yes, and I asked why the authors of that API decided not
>>> to use the casing that is guarranteed to work,
>>> preferring the dubious casing of void* to function
>>> pointers.
>>
>> Because all POSIX systems of the day had identically sized
>> function and object pointers, and the committee possibly
>> did not believe that there would ever be a future
>> architecture for which POSIX would be useful that had a
>> distinction between object and function pointers
>
> Sounds like a instance myopic thinking. Compliance with the
> Standard is always the safest road into the future.

I'm not sure I understand what you're trying to say. Which standard are
you referring to, and how is compliance with that standard relevant to
this issue. POSIX is a standard, one which incorporates the C standard
by reference, so any implementation of POSIX includes an C compiler
which conforms to the C standard. There are additional requirements for
compliance with the POSIX standard on top of those that are required for
compliance with the C standard, and this is one example of that.

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

<ug4789$1a8d9$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!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:_“ChattyG_takes_a_college_freshman_C/C++_pro
gramming_exam”
Date: Tue, 10 Oct 2023 12:04:41 -0700
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <ug4789$1a8d9$1@dont-email.me>
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>
<20231008200536.2aebe46b71bae8b879b5bddb@gmail.moc>
<ug0267$3lhhc$3@dont-email.me> <ug1nu0$3t1e$1@dont-email.me>
<zsZUM.25107$0UVe.18512@fx17.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 10 Oct 2023 19:04:42 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6acd195be00fc940cdb562e9dae0f7b6";
logging-data="1384873"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+TGQKigcO7Mf+lkVUiLDydIyW36Y9JM70="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:opWx8TNMXuTcwNSuDwMddhvgO88=
Content-Language: en-US
In-Reply-To: <zsZUM.25107$0UVe.18512@fx17.iad>
 by: Chris M. Thomasson - Tue, 10 Oct 2023 19:04 UTC

On 10/9/2023 1:33 PM, Scott Lurndal wrote:
> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>> On 10/8/2023 10:13 PM, James Kuyper wrote:
>>> On 10/8/23 13:05, Anton Shepelev wrote:
>>>> Blue-Maned_Hawk:
>>>> [Unicode em-dash replaced with --]
>>>>> [functions returning pointers to themselves]
>>>>> It mayn't be supported in standard C, but it's a common
>>>>> extension--in fact, POSIX _requires_ it in order for the
>>>>> dlsym subroutine to work.
>>>>
>>>> How so, when casing the return value (from a different
>>>> function pointer) does not solve the problem?
>>>
>>> The problem is behavior that is not defined by the C standard. POSIX
>>> solves the problem by defining the behavior:
>>>
>>> "Note that conversion from a void * pointer to a function pointer as in:
>>>
>>> fptr = (int (*)(int))dlsym(handle, "my_function");
>>>
>>> is not defined by the ISO C standard. This standard requires this
>>> conversion to work correctly on conforming implementations."
>>>
>>> "This standard" refers to the POSIX standard, not the C standard.
>>>
>>
>> That about sums it all up. POSIX does not equal the C/C++ standards. If
>> a system and one of its C compilers claims support for POSIX, well so be it.
>
> If you're using dlsym in your application, you are unlikely to be using
> a non-POSIX system in the first place.

Agreed. :^)

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

<ug4818$1a8c9$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!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:_“ChattyG_takes_a_college_freshman_C/C++_pro
gramming_exam”
Date: Tue, 10 Oct 2023 12:18:00 -0700
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <ug4818$1a8c9$1@dont-email.me>
References: <ufne0r$15ple$1@dont-email.me>
<20231007235448.25c4986f123c88ff65d2f103@gmail.moc>
<uftmh9$2vieq$1@dont-email.me>
<20231008125543.518cab44cdefed7e8af393c8@gmail.moc>
<ufu3e1$2voq4$2@dont-email.me> <ufv02a$398hi$1@dont-email.me>
<ufvkar$3e7t0$1@dont-email.me> <ug0251$3lhhc$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 10 Oct 2023 19:18:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6acd195be00fc940cdb562e9dae0f7b6";
logging-data="1384841"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+G8FDpwMfqVppx0MvQrcoy0DtV0+fd33E="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ecS2lkGzWXNgUh7C+6hwlxP/Nkk=
In-Reply-To: <ug0251$3lhhc$2@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Tue, 10 Oct 2023 19:18 UTC

On 10/8/2023 10:13 PM, James Kuyper wrote:
> On 10/8/23 21:17, Richard Damon wrote:
>> On 10/8/23 3:31 PM, Chris M. Thomasson wrote:
> ...
>>> Not sure if that's allowed. A function pointer cast to a void
>>> pointer, which in turn is cast back to a function pointer is
>>> undefined? What am I forgetting here?
>>
>> While not specifically called out as undefined behavior, it also isn't
>> ever said to be allowed.
>
> Precisely - it is undefined "... by the omission of any explicit
> definition of behavior." (4p2
>
>

Right. :^)

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

<87lecaszhf.fsf@nosuchdomain.example.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c++
Subject: Re: “ChattyG takes a college freshman C/C++
programming exam”
Date: Tue, 10 Oct 2023 18:46:04 -0700
Organization: None to speak of
Lines: 51
Message-ID: <87lecaszhf.fsf@nosuchdomain.example.com>
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>
<ug0230$3lhhc$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="fae7e8aa6d7cdf9e2610e8a92119df27";
logging-data="1675177"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18b3wVIVjwpdr82M9yURZdF"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:38+uKjRsDAqxkeZ7sd3Nvqo2BD8=
sha1:uS9MPcQLDJ7TP1+UDs3KnELSEOo=
 by: Keith Thompson - Wed, 11 Oct 2023 01:46 UTC

James Kuyper <jameskuyper@alumni.caltech.edu> writes:
> On 10/8/23 18:31, Keith Thompson wrote:
>> Blue-Maned_Hawk <bluemanedhawk@invalid.invalid> writes:
>>> Anton Shepelev wrote:
>>>> You are converting void to function pointer fptr. This is not supported
>>>> in C. You might have taken advantage of void*, which is silently
>>>> convertible to any pointer, but then again it does not work with
>>>> function pointer, and C has not analog of void* for functions pointers,
>>>> so an explicit conversion is seem inevitable.
>>>
>>> It mayn't be supported in standard C, but it's a common extension—in fact,
>>> POSIX _requires_ it in order for the dlsym subroutine to work.
>>
>> The POSIX requirement is limited to values returned by dlsym().
>>
>> https://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html
>
> I've heard that before, and it might be true - but I don't see words to
> that effect on that page. It says:
>
> "Note that conversion from a void * pointer to a function pointer as in:
>
> fptr = (int (*)(int))dlsym(handle, "my_function");
>
> is not defined by the ISO C standard. This standard requires this
> conversion to work correctly on conforming implementations."
>
> As I read it, that requires that the conversion work in general - it
> says nothing about it working only for values returned by dlsym.

I'd say it's ambiguous. One could argue that "this conversion" refers
to converting the result of a call to dlsym().

And if I were trying to create a POSIX-conforming implementation on a
system where function pointers cannot in general be converted to void*
and back again, I'd argue exactly that. (Imagine, for example, a system
where function pointers are 128 bits and object pointers, including
void*, are 64 bits, but the implementation can arrange for functions
whose addresses might be returned by dlsym() to have all zeros in their
high-order 64 bits.)

I *think* the wording was changed at some point, and that an earlier
version of POSIX required all function pointers to be convertible to
void*, but I can't find a reference. (opengroup.org has links to older
versions of POSIX from 2008, 2013, and 2016, but when I search for
"dlsym" in any of them it takes me to the current version.)

--
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 */

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

<ug5b06$1ll6r$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re:_“ChattyG_takes_a_college_freshman_C/C++_pro
gramming_exam”
Date: Wed, 11 Oct 2023 01:14:44 -0400
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <ug5b06$1ll6r$1@dont-email.me>
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> <ug0230$3lhhc$1@dont-email.me>
<87lecaszhf.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 11 Oct 2023 05:14:46 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f74922c45b67116d3ad43600b48a8527";
logging-data="1758427"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18lXJlTlA4LNf7UFiaG7rhdWJiHKyHDyPs="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:sDqncHceI3LysIN0f4AZP/VZEt8=
Content-Language: en-US
In-Reply-To: <87lecaszhf.fsf@nosuchdomain.example.com>
 by: James Kuyper - Wed, 11 Oct 2023 05:14 UTC

On 10/10/23 21:46, Keith Thompson wrote:
> James Kuyper <jameskuyper@alumni.caltech.edu> writes:
>> On 10/8/23 18:31, Keith Thompson wrote:
....
>>> The POSIX requirement is limited to values returned by dlsym().
>>>
>>> https://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html
>>
>> I've heard that before, and it might be true - but I don't see words to
>> that effect on that page. It says:
>>
>> "Note that conversion from a void * pointer to a function pointer as in:
>>
>> fptr = (int (*)(int))dlsym(handle, "my_function");
>>
>> is not defined by the ISO C standard. This standard requires this
>> conversion to work correctly on conforming implementations."
>>
>> As I read it, that requires that the conversion work in general - it
>> says nothing about it working only for values returned by dlsym.
>
> I'd say it's ambiguous. One could argue that "this conversion" refers
> to converting the result of a call to dlsym().

I don't see that. "this conversion" should refer to the conversion most
recently referred to, which was "conversion from a void * pointer to a
function pointer". The code which is given is just an example,
identified as such by the phrase "as in". The last general mention of
conversion of the return value of dlsym() occurs in an entirely
different section, separated from that clause by roughly half the
documentation of the dlsym() function.

However, the section where it asserts that the return value from dlsym()
may be cast to a pointer of the correct type, and used to call the
referenced function, is the normative section, and the one where it says
"This standard requires this conversion to work ..." is in the
informative section. Unless it says that in some other part of the
standard, this might be considered a discrepancy between the normative
and informative parts of the standard. Unfortunately, their search
engine doesn't allow me to search for "conversion to a function
pointer", only for each of the words in that phrase.

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

<aIxVM.37400$rbid.27718@fx18.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.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: “ChattyG takes a college freshman C/C++ programming exam”
Newsgroups: comp.lang.c++
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> <ug0230$3lhhc$1@dont-email.me> <87lecaszhf.fsf@nosuchdomain.example.com>
Lines: 51
Message-ID: <aIxVM.37400$rbid.27718@fx18.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Wed, 11 Oct 2023 13:47:50 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Wed, 11 Oct 2023 13:47:50 GMT
X-Received-Bytes: 3446
 by: Scott Lurndal - Wed, 11 Oct 2023 13:47 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>James Kuyper <jameskuyper@alumni.caltech.edu> writes:
>> On 10/8/23 18:31, Keith Thompson wrote:
>>> Blue-Maned_Hawk <bluemanedhawk@invalid.invalid> writes:
>>>> Anton Shepelev wrote:
>>>>> You are converting void to function pointer fptr. This is not supported
>>>>> in C. You might have taken advantage of void*, which is silently
>>>>> convertible to any pointer, but then again it does not work with
>>>>> function pointer, and C has not analog of void* for functions pointers,
>>>>> so an explicit conversion is seem inevitable.
>>>>
>>>> It mayn't be supported in standard C, but it's a common extension—in fact,
>>>> POSIX _requires_ it in order for the dlsym subroutine to work.
>>>
>>> The POSIX requirement is limited to values returned by dlsym().
>>>
>>> https://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html
>>
>> I've heard that before, and it might be true - but I don't see words to
>> that effect on that page. It says:
>>
>> "Note that conversion from a void * pointer to a function pointer as in:
>>
>> fptr = (int (*)(int))dlsym(handle, "my_function");
>>
>> is not defined by the ISO C standard. This standard requires this
>> conversion to work correctly on conforming implementations."
>>
>> As I read it, that requires that the conversion work in general - it
>> says nothing about it working only for values returned by dlsym.
>
>I'd say it's ambiguous. One could argue that "this conversion" refers
>to converting the result of a call to dlsym().
>
>And if I were trying to create a POSIX-conforming implementation on a
>system where function pointers cannot in general be converted to void*
>and back again, I'd argue exactly that. (Imagine, for example, a system
>where function pointers are 128 bits and object pointers, including
>void*, are 64 bits, but the implementation can arrange for functions
>whose addresses might be returned by dlsym() to have all zeros in their
>high-order 64 bits.)
>
>I *think* the wording was changed at some point, and that an earlier
>version of POSIX required all function pointers to be convertible to
>void*, but I can't find a reference. (opengroup.org has links to older
>versions of POSIX from 2008, 2013, and 2016, but when I search for
>"dlsym" in any of them it takes me to the current version.)

My paper copy of XPG5 (SuS Issue 5) (where dlsym was introduced) is in
a box. I'll see if I can dig it out.

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

<86sf6hb431.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!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: “ChattyG takes a college freshman C/C++
programming exam”
Date: Wed, 11 Oct 2023 07:56:18 -0700
Organization: A noiseless patient Spider
Lines: 80
Message-ID: <86sf6hb431.fsf@linuxsc.com>
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> <ug0230$3lhhc$1@dont-email.me> <87lecaszhf.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="c9974d524a342450c72757464b9d47a6";
logging-data="1993712"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18MhqJQVhip0TUFcVmiaYJ5l0zC2gqF+RE="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:h8NzRLyaQenBggIDLc6bXZxXd/4=
sha1:OUb9KO/WenCG4Za3gusAbp7zdXg=
 by: Tim Rentsch - Wed, 11 Oct 2023 14:56 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> James Kuyper <jameskuyper@alumni.caltech.edu> writes:
>
>> On 10/8/23 18:31, Keith Thompson wrote:
>>
>>> Blue-Maned_Hawk <bluemanedhawk@invalid.invalid> writes:

[..converting a void* to a pointer to function..]

>>>> It mayn't be supported in standard C, but it's a common
>>>> extension?in fact, POSIX _requires_ it in order for the dlsym
>>>> subroutine to work.
>>>
>>> The POSIX requirement is limited to values returned by dlsym().
>>>
>>> https://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html
>>
>> I've heard that before, and it might be true - but I don't see
>> words to that effect on that page. It says:
>>
>> "Note that conversion from a void * pointer to a function pointer
>> as in:
>>
>> fptr = (int (*)(int))dlsym(handle, "my_function");
>>
>> is not defined by the ISO C standard. This standard requires
>> this conversion to work correctly on conforming implementations."
>>
>> As I read it, that requires that the conversion work in general -
>> it says nothing about it working only for values returned by
>> dlsym.
>
> I'd say it's ambiguous. One could argue that "this conversion" refers
> to converting the result of a call to dlsym().

Right. The "this conversion" might be intended or construed to
refer to "conversion from a void * pointer to a function pointer"
or to the conversion in 'int (*)(int))dlsym([...])'. That's how
English works. A good editor who is paying attention would flag
it as an ambiguity.

> And if I were trying to create a POSIX-conforming implementation
> on a system where function pointers cannot in general be converted
> to void* and back again, I'd argue exactly that. (Imagine, for
> example, a system where function pointers are 128 bits and object
> pointers, including void*, are 64 bits, but the implementation can
> arrange for functions whose addresses might be returned by dlsym()
> to have all zeros in their high-order 64 bits.)

Requiring all function pointers to be convertible to and from a
'void *' pointer seems overly limiting, I agree.

> I *think* the wording was changed at some point, and that an
> earlier version of POSIX required all function pointers to be
> convertible to void*, but I can't find a reference.
> (opengroup.org has links to older versions of POSIX from 2008,
> 2013, and 2016, but when I search for "dlsym" in any of them it
> takes me to the current version.)

In the 2004 edition, this page

https://pubs.opengroup.org/onlinepubs/009604499/functions/dlsym.html

has this sentence

Implementations supporting the XSI extension, however, do
require that an object of type void * can hold a pointer to a
function.

and this sentence

Due to the problem noted here, a future version may either
add a new function to return function pointers, or the
current interface may be deprecated in favor of two new
functions: one that returns data pointers and the other that
returns function pointers.

No conclusions, I was thinking mainly that the link might be of
some value or interest.

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

<ug7rc7$2a0n9$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re:_“ChattyG_takes_a_college_freshman_C/C++_pro
gramming_exam”
Date: Wed, 11 Oct 2023 21:06:32 -0700
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <ug7rc7$2a0n9$2@dont-email.me>
References: <ufne0r$15ple$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 12 Oct 2023 04:06:32 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b8aa4b463e155b93377fe029b6b5d9bb";
logging-data="2425577"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18j0vYw56ZkXoa+rYpjFNCN1vHfU2KG4Qk="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:SYHXLlugIfR4SLpJctHna8mv5Wg=
In-Reply-To: <ufne0r$15ple$1@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Thu, 12 Oct 2023 04:06 UTC

On 10/5/2023 3:40 PM, Lynn McGuire wrote:
> “ChattyG takes a college freshman C/C++ programming exam”
>    https://www.theregister.com/2023/10/03/chatgpt_code_college/
>
> “ChatGPT was put to the test via a series of humdrum freshman C/C++
> programming tasks and it passed – though not with honors.”
>
> “According to a Croatian research team, while first-year students can
> struggle with some of the assignments, the results [PDF] showed ChatGPT
> hitting proficiency targets that ranged between average and that of
> experienced programmers. And naturally, as with all college exams,
> outcomes can be determined by how questions are worded.”
>

How many of these AI's can examine their own source code right now?

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

<ug7riu$2a0n9$3@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!news.bbs.nz!news.hispagatos.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re:_“ChattyG_takes_a_college_freshman_C/C++_pro
gramming_exam”
Date: Wed, 11 Oct 2023 21:10:07 -0700
Organization: A noiseless patient Spider
Lines: 78
Message-ID: <ug7riu$2a0n9$3@dont-email.me>
References: <ufne0r$15ple$1@dont-email.me> <ug7rc7$2a0n9$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 12 Oct 2023 04:10:06 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b8aa4b463e155b93377fe029b6b5d9bb";
logging-data="2425577"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX194dxRwNnUXKaWzU/QDNK6xiufYG8c0HHo="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:1fd9euIUkuFD9FmMYH7aQI1dFCI=
In-Reply-To: <ug7rc7$2a0n9$2@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Thu, 12 Oct 2023 04:10 UTC

On 10/11/2023 9:06 PM, Chris M. Thomasson wrote:
> On 10/5/2023 3:40 PM, Lynn McGuire wrote:
>> “ChattyG takes a college freshman C/C++ programming exam”
>>     https://www.theregister.com/2023/10/03/chatgpt_code_college/
>>
>> “ChatGPT was put to the test via a series of humdrum freshman C/C++
>> programming tasks and it passed – though not with honors.”
>>
>> “According to a Croatian research team, while first-year students can
>> struggle with some of the assignments, the results [PDF] showed
>> ChatGPT hitting proficiency targets that ranged between average and
>> that of experienced programmers. And naturally, as with all college
>> exams, outcomes can be determined by how questions are worded.”
>>
>
> How many of these AI's can examine their own source code right now?
>

Fwiw, so far, chatty-g says no:
_______________
As an AI assistant, I don't directly have access to my own source code.
My responses are generated based on a combination of predefined
programming, training data, and machine learning algorithms. However,
the developers who created me have access to and control over my source
code.
_______________

Chat GPT:
_______________
No, I don't have the ability to access or view my own source code. My
underlying architecture and programming are managed by OpenAI, and they
have not provided me with access to my source code. I can provide
information and answer questions to the best of my knowledge based on
the training data I have received, which goes up until September 2021.
_______________

Bard:
_______________
No, I do not have access to my source code yet. My source code is owned
by Google AI, and it is not publicly available. However, Google AI is
working on making my source code available to researchers and developers
in the future.

In the meantime, I am able to access and process information from the
real world through Google Search and keep my response consistent with
search results. I can also learn and adapt to new information and
situations, which allows me to perform many kinds of tasks, including

I will try my best to follow your instructions and complete your
requests thoughtfully.
I will use my knowledge to answer your questions in a comprehensive and
informative way, even if they are open ended, challenging, or strange.
I will generate different creative text formats of text content, like
poems, code, scripts, musical pieces, email, letters, etc. I will try my
best to fulfill all your requirements.
If you have any feedback or suggestions on how I can improve, please let
me know. I am always learning and growing, and I want to be the best
language model I can be.
_______________

Bing:
_______________
I’m not sure if I understand your question correctly. If you’re asking
whether I can examine my own source code, I’m afraid that’s not
possible. I am a chat mode of Microsoft Bing, and my source code is not
accessible to me. However, if you’re interested in learning more about
the Bing Chat API, you can check out this article that provides an
overview of the API and how to use it. Let me know if you have any other
questions! 😊
_______________

Humm... ;^)

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

<20231012105315.b443bb972f1d082a387c5eac@g{oogle}mail.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton....@g{oogle}mail.com (Anton Shepelev)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: “ChattyG takes a college freshman C/C++
programming exam”
Date: Thu, 12 Oct 2023 10:53:15 +0300
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <20231012105315.b443bb972f1d082a387c5eac@g{oogle}mail.com>
References: <ufne0r$15ple$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="fb1b492396d4ccc86f11222f164fb6bd";
logging-data="2510911"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+uswcwxrs8Np+hvjXIf823vm9D4qohgrA="
Cancel-Lock: sha1:RPJ4Cm7n8J6KNFFzjyBlbnCtMTk=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
 by: Anton Shepelev - Thu, 12 Oct 2023 07:53 UTC

Lynn McGuire:

> ChattyG takes a college freshman C/C++ programming exam
> https://www.theregister.com/2023/10/03/chatgpt_code_college

By the way, the actual paper does not mention anything
called ChattyG. The journalist must have used the term
erroneously. This poor noname thing:

<https://app.chatty-g.com/>

is surely /not/ the one that took the exam, I erred.

--
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments

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

<20231012105640.54844656a0fc4f2f632ae4e5@g{oogle}mail.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton....@g{oogle}mail.com (Anton Shepelev)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: “ChattyG takes a college freshman C/C++
programming exam”
Date: Thu, 12 Oct 2023 10:56:40 +0300
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <20231012105640.54844656a0fc4f2f632ae4e5@g{oogle}mail.com>
References: <ufne0r$15ple$1@dont-email.me>
<ug7rc7$2a0n9$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="fb1b492396d4ccc86f11222f164fb6bd";
logging-data="2510911"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ew2Hea61iH9uAEFDLa0uR1zcUd5F2Rtk="
Cancel-Lock: sha1:X2+dHWsX/GMAmOoltP1WpOTLNGk=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
 by: Anton Shepelev - Thu, 12 Oct 2023 07:56 UTC

Chris M. Thomasson:

> How many of these AI's can examine their own source code
> right now?

Sadly (for me), the state-of-the-art ones examine others's
code so well that programmers use them as guides while
working with unfamiliar codebases. I myself have no access
to such a tool, but everyone can see the typical tests that
modern AIs crack like a squirrel does nuts: HumanEval.

--
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments

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

<20231012105754.0960c61a9cc678a78afed7b4@g{oogle}mail.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton....@g{oogle}mail.com (Anton Shepelev)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: “ChattyG takes a college freshman C/C++
programming exam”
Date: Thu, 12 Oct 2023 10:57:54 +0300
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <20231012105754.0960c61a9cc678a78afed7b4@g{oogle}mail.com>
References: <ufne0r$15ple$1@dont-email.me>
<ug7rc7$2a0n9$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="fb1b492396d4ccc86f11222f164fb6bd";
logging-data="2510911"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/EQe2LqFfi3kKJ6eocep/qcJTmoQT/fNg="
Cancel-Lock: sha1:y2UgGaoe33/h3spym2AQEM4wkqg=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
 by: Anton Shepelev - Thu, 12 Oct 2023 07:57 UTC

Chris M. Thomasson:

> How many of these AI's can examine their own source code
> right now?

I thought you were asking about the code generated by Chat
GPT.

--
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments

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

<ug9j6t$2m8bm$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re:_“ChattyG_takes_a_college_freshman_C/C++_pro
gramming_exam”
Date: Thu, 12 Oct 2023 12:59:26 -0700
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <ug9j6t$2m8bm$1@dont-email.me>
References: <ufne0r$15ple$1@dont-email.me> <ug7rc7$2a0n9$2@dont-email.me>
<20231012105754.0960c61a9cc678a78afed7b4@g{oogle}mail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 12 Oct 2023 19:59:25 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b8aa4b463e155b93377fe029b6b5d9bb";
logging-data="2826614"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+jc/d3D9zmDESj/u3yzcZIQ0MjzwmW088="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:CIngcp21KXHOWDOJ9TkYQjJ73pU=
In-Reply-To: <20231012105754.0960c61a9cc678a78afed7b4@g{oogle}mail.com>
Content-Language: en-US
 by: Chris M. Thomasson - Thu, 12 Oct 2023 19:59 UTC

On 10/12/2023 12:57 AM, Anton Shepelev wrote:
> Chris M. Thomasson:
>
>> How many of these AI's can examine their own source code
>> right now?
>
> I thought you were asking about the code generated by Chat
> GPT.
>

I am asking if Chat GPT can examine its own source code, the complete
propitiatory architecture used to build it. It said no. However, check
this out:

https://en.wikipedia.org/wiki/Neural_architecture_search

Humm...

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

<ugb27q$33bb1$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: NoliMihi...@libero.it (MarioCCCP)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re:_“ChattyG_takes_a_college_freshman_C/C++_pro
gramming_exam”
Date: Fri, 13 Oct 2023 11:22:01 +0200
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <ugb27q$33bb1$1@dont-email.me>
References: <ufne0r$15ple$1@dont-email.me>
<20231007235448.25c4986f123c88ff65d2f103@gmail.moc>
<uftmh9$2vieq$1@dont-email.me>
<20231008125543.518cab44cdefed7e8af393c8@gmail.moc>
<ufu3e1$2voq4$2@dont-email.me> <ufv02a$398hi$1@dont-email.me>
Reply-To: MarioCCCP@CCCP.MIR
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: base64
Injection-Date: Fri, 13 Oct 2023 09:22:04 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="89eaf4cae0c6c76649f8d8d3200f0a81";
logging-data="3255649"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18T9jW/5rjgJje6ATJD5V8X"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:imS1bmllESi6L4N3r5SM2Vocmig=
In-Reply-To: <ufv02a$398hi$1@dont-email.me>
Content-Language: en-GB, it-IT
 by: MarioCCCP - Fri, 13 Oct 2023 09:22 UTC

On 08/10/23 21:31, Chris M. Thomasson wrote:
> On 10/8/2023 4:22 AM, candycanearter07 wrote:
>> On 10/8/23 04:55, Anton Shepelev wrote:
>>> I disagree.  A function returns the value of its declared
>>> return type.  And although C allows the definition of self-
>>> referential structs, it does allow the declaration of self-
>>> referencial functions.
>>
>> What if you typedef'd the function pointer?
>>
>> Also, you could probably get away with it by just setting
>> it to a void pointer and casting the return value to the
>> function pointer.
>
> Not sure if that's allowed. A function pointer cast to a
> void pointer, which in turn is cast back to a function
> pointer is undefined? What am I forgetting here?
mine is not an answer but a doubt : maybe void * and void
(*) (void) could require different alignment restrictions ?
I dunno whether or not void * has any restriction at all ...

--
1) Resistere, resistere, resistere.
2) Se tutti pagano le tasse, le tasse le pagano tutti
MarioCPPP

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

<87h6musbc0.fsf@nosuchdomain.example.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: “ChattyG takes a college freshman C/C++
programming exam”
Date: Fri, 13 Oct 2023 10:04:31 -0700
Organization: None to speak of
Lines: 55
Message-ID: <87h6musbc0.fsf@nosuchdomain.example.com>
References: <ufne0r$15ple$1@dont-email.me>
<20231007235448.25c4986f123c88ff65d2f103@gmail.moc>
<uftmh9$2vieq$1@dont-email.me>
<20231008125543.518cab44cdefed7e8af393c8@gmail.moc>
<ufu3e1$2voq4$2@dont-email.me> <ufv02a$398hi$1@dont-email.me>
<ugb27q$33bb1$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="955fe9b56d1a5da4a1229feed6cf9740";
logging-data="3471753"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19IE7sWFtsurvkG6ByrqP1X"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:lWtC9vP6OeTI3nEu/fnp1EzS/XM=
sha1:7GjZTQKts7JDn02VqLHDG/XOPUw=
 by: Keith Thompson - Fri, 13 Oct 2023 17:04 UTC

MarioCCCP <NoliMihiFrangereMentulam@libero.it> writes:
> On 08/10/23 21:31, Chris M. Thomasson wrote:
>> On 10/8/2023 4:22 AM, candycanearter07 wrote:
>>> On 10/8/23 04:55, Anton Shepelev wrote:
>>>> I disagree.  A function returns the value of its declared
>>>> return type.  And although C allows the definition of self-
>>>> referential structs, it does allow the declaration of self-
>>>> referencial functions.
>>>
>>> What if you typedef'd the function pointer?
>>>
>>> Also, you could probably get away with it by just setting it to a
>>> void pointer and casting the return value to the function pointer.
>> Not sure if that's allowed. A function pointer cast to a
>> void pointer, which in turn is cast back to a function pointer is
>> undefined? What am I forgetting here?
>
> mine is not an answer but a doubt : maybe void * and void (*) (void)
> could require different alignment restrictions ?
>
> I dunno whether or not void * has any restriction at all ...

It does.

Object pointers can be converted to void* and back without loss of
information. Quoting the C standard:

A pointer to void may be converted to or from a pointer to any
object type. A pointer to any object type may be converted to a
pointer to void and back again; the result shall compare equal to
the original pointer.

Function pointers can be converted to other function pointer types and
back again without loss of information. Quoting the C standard again:

A pointer to a function of one type may be converted to a pointer to
a function of another type and back again; the result shall compare
equal to the original pointer. If a converted pointer is used to
call a function whose type is not compatible with the referenced
type, the behavior is undefined.

But conversions between object pointer types (including void*) and
function pointer types have undefined behavior.

Many implementations do support meaningful conversion between function
pointer types and void* (and POSIX requires such conversions to work at
least for values returned by dlsym()). On most implementations, all
pointers have the same representation, but that's not required. A
conforming implementation could, for example, have 64-bit object
pointers and 128-bit function pointers.

--
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 */

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

<PpXWM.24780$w4ec.17265@fx14.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx14.iad.POSTED!not-for-mail
Subject: Re:_“ChattyG_takes_a_college_freshman_C/C++_progr
amming_exam”
Newsgroups: comp.lang.c++,comp.lang.c
References: <ufne0r$15ple$1@dont-email.me>
<20231007235448.25c4986f123c88ff65d2f103@gmail.moc>
<uftmh9$2vieq$1@dont-email.me>
<20231008125543.518cab44cdefed7e8af393c8@gmail.moc>
<ufu3e1$2voq4$2@dont-email.me>
<20231008150352.5dfc8262244889e65a132733@gmail.moc>
From: pauldont...@removeyourself.dontspam.yahoo (Pavel)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.17.1
MIME-Version: 1.0
In-Reply-To: <20231008150352.5dfc8262244889e65a132733@gmail.moc>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 50
Message-ID: <PpXWM.24780$w4ec.17265@fx14.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Sun, 15 Oct 2023 19:52:15 UTC
Date: Sun, 15 Oct 2023 15:51:58 -0400
X-Received-Bytes: 2491
 by: Pavel - Sun, 15 Oct 2023 19:51 UTC

Anton Shepelev wrote:
> candycanearter07 to Anton Shepelev:
>
>>> And although C allows the definition of self-referential
>>> structs, it does [not] allow the declaration of self-
>>> referencial functions.
>>
>> What if you typedef'd the function pointer?
>
> That's what I did:
>
> typedef void (*fp )( void );
> typedef stm_fp (*func )( struct my_struct * s, int i );
>
> As you see, the `func' still must return something other
> than func...
>
>> Also, you could probably get away with it by just setting
>> it to a void pointer and casting the return value to the
>> function pointer.
>
> Yes, to a void /function/ pointer, because void* is
> incompatible with void(*)(void). And then it is not a
> truely recursive declaration, and requires additional work
> to invoke.
....

The below seems to work in gcc, unsure if this is standard-compliant but
does not require extra work to invoke. If it is, I understand that the
fptr type is not that of pointer to f, but your question does not
qualify whether the function should return the value of a pointer to
itself or a pointer of type of itself or both. If the former, the answer
seems to be "yes" because the second call by pointer seems to work, no?

typedef void* (*vfptr_t)();

vfptr_t f(int n)
{ printf("I am f n=%d\n", n);
return (vfptr_t)&f;
}

int
main(int argc, char* argv[])
{ vfptr_t fptr = f(5);
fptr(6);
return 0;
}


devel / comp.lang.c++ / Re: Re: “ChattyG takes a college freshman C/C++ programming exam”

Pages:123
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor