Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Two different Results between C and C++ Date: Thu, 10 Sep 2020 12:46:42 -0700 Organization: None to speak of Lines: 85 Message-ID: <87o8mdifdp.fsf@nosuchdomain.example.com> References: <8c6495f9-6139-464e-ac8f-4eac27a92776@googlegroups.com> <60d0f73c-8588-4673-a48d-e5c4cc726196@googlegroups.com> <87blm1wam0.fsf@nosuchdomain.example.com> <86d05skg6z.fsf@linuxsc.com> <87tuz4gt4c.fsf@nosuchdomain.example.com> <86sgbx7sui.fsf@linuxsc.com> <87a6y5z8ge.fsf@nosuchdomain.example.com> <86lfhh6fye.fsf@linuxsc.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="9b68d563e8678dfb6dea6d53a7359e8f"; logging-data="13844"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19TInUwY9/FhMFMz/qA62yy" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cancel-Lock: sha1:kusCv1BebXDkVKBxOsOVyc2rCYc= sha1:bwHr01Iokhz4i2nXe2v0LfQ8big= Xref: csiph.com comp.lang.c:154830 Tim Rentsch writes: > Keith Thompson 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 */