Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #82670
| Path | csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
| Newsgroups | comp.lang.c++ |
| Subject | Re: Can extern "C" functions throw exceptions |
| Date | Thu, 16 Dec 2021 19:24:21 -0800 |
| Organization | A noiseless patient Spider |
| Lines | 52 |
| Message-ID | <86wnk33od6.fsf@linuxsc.com> (permalink) |
| References | <shi0pt$71u$1@dont-email.me> <shi5g0$9cu$1@dont-email.me> <shiree$hq9$1@dont-email.me> <shkgol$3cc$2@gioia.aioe.org> <20210912144443.a174f80b419b5694959f26d9@cvine--nospam--.freeserve.co.uk> <shmflb$74h$4@dont-email.me> <86a6jlrjyd.fsf@linuxsc.com> <9106335c-2f48-4735-8c69-2b829fc450ccn@googlegroups.com> <868rwm6adq.fsf@linuxsc.com> <2014666f-87aa-4eb6-8fc0-f0d0addd5011n@googlegroups.com> <j1vemjF6hohU1@mid.individual.net> <86ee6c4tfm.fsf@linuxsc.com> <j21mg5FcbslU1@mid.individual.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Info | reader02.eternal-september.org; posting-host="80deed38cb7e1387fac9e84aa4dded6e"; logging-data="14863"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18c4btZpbXRRY/tCCRk/43AVgoXeEjynNg=" |
| User-Agent | Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) |
| Cancel-Lock | sha1:ZiQwYiJGYWG1nCxOrp98+lZEuBw= sha1:wLMJV7u17XqBRFGpdvsf6mzH/Vo= |
| Xref | csiph.com comp.lang.c++:82670 |
Show key headers only | View raw
Ian Collins <ian-news@hotmail.com> writes:
> On 17/12/2021 01:37, Tim Rentsch wrote:
>
>> Ian Collins <ian-news@hotmail.com> writes:
>>
>>> On 15/12/2021 16:06, james...@alumni.caltech.edu wrote:
>>>
>>>> On Tuesday, December 14, 2021 at 6:21:38 PM UTC-5, Tim Rentsch wrote:
>>>>
>>>>> between a type with a C language linkage and a C++ language
>>>>> linkage. Apparently most compilers ignore the distinction
>>>>> because following the rules would break too much code. Here
>>>>> is a link to stackoverflow with more information:
>>>>>
>>>>> https://stackoverflow.com/questions/26647259/
>>>>> is-extern-c-a-part-of-the-type-of-a-function
>>>>
>>>> The standard is quite clear: "Two function types with different
>>>> language linkages are distinct types even if they are otherwise
>>>> identical." (9.11p1). I'm annoyed, but unfortunately not
>>>> surprised, to find that this has been ignored. I've never had
>>>> any need to write code where that issue would matter, which is
>>>> why I've never noticed.
>>>
>>> I have only used one compiler, Sun CC, that bothered to enforce
>>> the rule. At the time, the main problem this caused me was it
>>> prevented static member functions being passed to pthread_create,
>>> I had to use extern "C" qualified friend function on Solaris.
>>
>> Did you try a pattern like this:
>>
>> extern "C" typedef void Whatsit( double * );
>>
>> class Foo {
>> public:
>> static Whatsit fred;
>> };
>>
>> void
>> Foo::fred( double *things ){
>> for( int i = 0; i < 10; i++ ) things[i] += i;
>> }
>>
>> This code is accepted by g++ back to -std=c++98. Of course,
>> since we know the gnu tools are compromised that doesn't tell us
>> very much...
>
> No, I just used friend unctions, your suggestion would have been
> interesting to try, but I no longer have those tools installed.
Okay, thank you. I was asking only out of curiosity.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Can extern "C" functions throw exceptions Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-11 12:35 +0200
Re: Can extern "C" functions throw exceptions Bo Persson <bo@bo-persson.se> - 2021-09-11 13:49 +0200
Re: Can extern "C" functions throw exceptions "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2021-09-11 13:57 +0200
Re: Can extern "C" functions throw exceptions Paavo Helde <myfirstname@osa.pri.ee> - 2021-09-11 15:19 +0300
Re: Can extern "C" functions throw exceptions Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-11 15:32 +0200
Re: Can extern "C" functions throw exceptions HorseyWorsey@the_stables.com - 2021-09-11 15:54 +0000
Re: Can extern "C" functions throw exceptions "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2021-09-11 13:55 +0200
Re: Can extern "C" functions throw exceptions Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-11 15:34 +0200
Re: Can extern "C" functions throw exceptions Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-11 15:58 +0200
Re: Can extern "C" functions throw exceptions "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2021-09-11 17:00 +0200
Re: Can extern "C" functions throw exceptions "daniel...@gmail.com" <danielaparker@gmail.com> - 2021-10-06 13:36 -0700
Re: Can extern "C" functions throw exceptions Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2021-10-06 20:42 +0000
Re: Can extern "C" functions throw exceptions Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-06 16:12 -0700
Re: Can extern "C" functions throw exceptions Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2021-10-06 23:22 +0000
Re: Can extern "C" functions throw exceptions Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-06 17:03 -0700
Re: Can extern "C" functions throw exceptions HorseyWorsey@the_stables.com - 2021-09-11 15:56 +0000
Re: Can extern "C" functions throw exceptions David Brown <david.brown@hesbynett.no> - 2021-09-11 20:10 +0200
Re: Can extern "C" functions throw exceptions Juha Nieminen <nospam@thanks.invalid> - 2021-09-12 09:20 +0000
Re: Can extern "C" functions throw exceptions Paavo Helde <myfirstname@osa.pri.ee> - 2021-09-12 12:34 +0300
Re: Can extern "C" functions throw exceptions David Brown <david.brown@hesbynett.no> - 2021-09-12 12:24 +0200
Re: Can extern "C" functions throw exceptions Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-12 12:29 +0200
Re: Can extern "C" functions throw exceptions Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2021-09-12 14:44 +0100
Re: Can extern "C" functions throw exceptions James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-09-12 23:13 -0400
Re: Can extern "C" functions throw exceptions David Brown <david.brown@hesbynett.no> - 2021-09-13 09:30 +0200
Re: Can extern "C" functions throw exceptions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-10-06 13:12 -0700
Re: Can extern "C" functions throw exceptions "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> - 2021-10-07 07:09 -0700
Re: Can extern "C" functions throw exceptions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-12-14 15:21 -0800
Re: Can extern "C" functions throw exceptions Richard Damon <Richard@Damon-Family.org> - 2021-12-14 21:17 -0500
Re: Can extern "C" functions throw exceptions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-12-16 04:21 -0800
Re: Can extern "C" functions throw exceptions "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> - 2021-12-14 19:06 -0800
Re: Can extern "C" functions throw exceptions Ian Collins <ian-news@hotmail.com> - 2021-12-16 13:14 +1300
Re: Can extern "C" functions throw exceptions "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-12-15 18:05 -0800
Re: Can extern "C" functions throw exceptions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-12-16 04:37 -0800
Re: Can extern "C" functions throw exceptions Ian Collins <ian-news@hotmail.com> - 2021-12-17 09:39 +1300
Re: Can extern "C" functions throw exceptions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-12-16 19:24 -0800
Re: Can extern "C" functions throw exceptions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-12-16 04:29 -0800
Re: Can extern "C" functions throw exceptions Juha Nieminen <nospam@thanks.invalid> - 2021-09-13 05:34 +0000
Re: Can extern "C" functions throw exceptions Paavo Helde <myfirstname@osa.pri.ee> - 2021-09-13 09:55 +0300
Re: Can extern "C" functions throw exceptions Paavo Helde <myfirstname@osa.pri.ee> - 2021-09-11 15:12 +0300
Re: Can extern "C" functions throw exceptions red floyd <no.spam.here@its.invalid> - 2021-09-13 13:21 -0700
csiph-web