Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #154794
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Two different Results between C and C++ |
| Date | 2020-09-10 04:15 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <86lfhh6fye.fsf@linuxsc.com> (permalink) |
| References | (4 earlier) <87blm1wam0.fsf@nosuchdomain.example.com> <86d05skg6z.fsf@linuxsc.com> <87tuz4gt4c.fsf@nosuchdomain.example.com> <86sgbx7sui.fsf@linuxsc.com> <87a6y5z8ge.fsf@nosuchdomain.example.com> |
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
[edited to remove some extraneous or repeated material]
>>>>> [A]lmost all programs that are legal C but not legal C++ can be
>>>>> made into legal C++ with a small effort.
>>>>
>>>> This claim sounds like an article of faith, being offered without
>>>> either proof or evidence. If meant as just an empirical
>>>> statement then of course there is no way anyone can know that.
>>>
>>> When I wrote "almost all programs that are legal C but not legal
>>> C++", I was referring to real-world programs, not the infinite set
>>> of all possible programs. I probably could have made that clearer.
>>
>> So you meant to consider only those C programs that have actually
>> been written, rather than making a statement that would apply to
>> any well-formed C program? So the statement was meant in the
>> sense of "almost all existing programs" that are well-formed C?
>>
>>> My statement was not an "article of faith". It was somewhat
>>> speculative.
[...]
>> Incidentally, I don't know why you put the phrase article of
>> faith in scare quotes. It's an established phrase in regular
>> English, dating back at least 500 years. A typical definition
>> is "a deeply held belief".
>
> Those were not scare quotes. You introduced the phrase "article
> of faith" into this discussion. I was directly quoting you.
The phrase is used with its ordinary English meaning, so there is
no particular reason to quote it. The quotes therefore come
across as scare quotes whether they were meant that way or not.
>>> I think it was correct, but it's not worth the effort to
>>> perform a major research project to verify it.
>>
>> Let's think about what you're saying. How many C programs have
>> actually been written? A hundred thousand? A million? Of those,
>> how many have you actually looked at? Probably a few hundred, but
>> let's guess a thousand. Of the C programs you've seen, how many
>> have you actually tried to convert to C++? Five? Ten? Twenty?
>> Assuming the number is 20 and that 200,000 C programs have been
>> written, that is 0.01%. Furthermore getting a C program to the
>> point where it will compile as C++ is not the same as it being the
>> same program. Even if we know the semantics of the C program was
>> not changed by modifying it, there remains the question of whether
>> the program has the same semantics in C++. Do you think you know
>> all the ways that well-formed C code can have different semantics
>> when compiled as C++? If you don't, then we shouldn't have much
>> confidence in your estimate of the effort required to accomplish
>> the modification, since we don't know whether the goal was actually
>> reached. Is this what you mean when you say your claim is somewhat
>> speculative? If it is then the word "somewhat" seems vastly
>> understated.
>
> Not every idle statement requires a research program to verify it.
>
> Given my experience with C and C++, my *general impression* is
> that most C programs can be made into valid C++ programs with the
> same semantics without great effort by someone knowledgeable in
> both languages. I speculate that the level of effort would be
> similar to that for porting a program from one version of C to a
> later one, or from one version of C++ to a later one.
>
> I don't know off the top of my head all the ways that valid C
> code can be valid C++ code with different semantics, but I
> believe there's an annex in the C++ standard that provides that
> information.
>
> I didn't expect that statement to be controversial, and I *DO
> NOT CARE* enough about this to spend the time it would take to
> establish it more firmly.
>
> I note that you haven't said you disagree with my statement;
> rather you seem to be criticizing the way I said it. I can't
> even tell whether you agree or not. If you disagreed, I would
> ask you to offer evidence.
I'm not asking you to conduct a research program or verify
anything. I'm just trying to determine the basis for your
statement.
At this point my summary might be something like this: based on
your experience you think most C programs should be convertible
to C++ without too much effort, but you aren't offering any
reasons why anyone else should think so. Is that a fair
(partial) summary of your comments?
Note on C.1 (in n4659). Annex C.1 paragraph 1 says
This subclause lists the differences between C++ and ISO C,
by the chapters of this document.
Despite that statement, the list is incomplete. For starters it
is based on C90, and has AFAICT not been updated for C99 or C11.
There are other problems but I don't know (and haven't made any
particular effort to discover) what they all are.
As to my own reaction, before I agree or disagree I think it is
important to understand, first, exactly what it is you are
asserting or positing, and second, what leads you to think so.
(One reason for the second part is understanding the second
part may inform some aspects of the first part.) My sense of
what you are saying has changed at least twice during the
conversation, so I would like to wait until that converges
before giving any further reaction to it.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar
Re: Two different Results between C and C++ Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-09-04 03:13 -0700
Re: Two different Results between C and C++ Kaz Kylheku <793-849-0957@kylheku.com> - 2020-09-04 18:44 +0000
Re: Two different Results between C and C++ David Brown <david.brown@hesbynett.no> - 2020-09-05 15:57 +0200
Re: Two different Results between C and C++ Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-09-08 08:27 -0700
Re: Two different Results between C and C++ James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-09-08 17:50 -0700
Re: Two different Results between C and C++ James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-09-08 21:07 -0400
Re: Two different Results between C and C++ Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-09-08 18:28 -0700
Re: Two different Results between C and C++ James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-09-08 22:14 -0400
Re: Two different Results between C and C++ Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-09-10 06:35 -0700
Re: Two different Results between C and C++ Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-09-04 11:46 -0700
Re: Two different Results between C and C++ Kaz Kylheku <793-849-0957@kylheku.com> - 2020-09-04 19:07 +0000
Re: Two different Results between C and C++ Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-09-10 04:15 -0700
Re: Two different Results between C and C++ Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-09-10 12:46 -0700
csiph-web