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


Groups > comp.lang.c > #154830

Re: Two different Results between C and C++

From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: Two different Results between C and C++
Date 2020-09-10 12:46 -0700
Organization None to speak of
Message-ID <87o8mdifdp.fsf@nosuchdomain.example.com> (permalink)
References (5 earlier) <86d05skg6z.fsf@linuxsc.com> <87tuz4gt4c.fsf@nosuchdomain.example.com> <86sgbx7sui.fsf@linuxsc.com> <87a6y5z8ge.fsf@nosuchdomain.example.com> <86lfhh6fye.fsf@linuxsc.com>

Show all headers | View raw


Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
[...]
>> 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.

The basis for my statement was that it seems obviously true given
what I know of the relationship between the two languages.  The fact
that nobody here has offered a refutation reinforces that opinion.

> 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?

I suppose so.  If someone offered an actual counterargument,
or even a contrary opionion, I might be motivated to support my
statement further.

> 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.

You've had ample opportunities to demonstrate that it's incomplete
by showing a difference that isn't listed.

As for whether it's been updated for C99 or C11, you seem to
be correct.  C.1.3 [diff.expr] paragraph 2 is "Change: Implicit
declaration of functions is not allowed", which is inapplicable
starting with C99, and paragraph 5 is "Change: Banning implicit int".
I'm mildly surprised that this hasn't been updated, even in the
latest draft I have.

A C program that uses _Generic or compound literals would be slightly
more difficult to convert to valid C++.

> 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.

It seems that it would take a great deal of effort on my part for you
to be comfortable expressing an opinion on the original statement.
I have no plans to expend that effort.  I've probably spent too much
time on this already.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */

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


Thread

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