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: Fri, 05 Jun 2020 11:33:08 -0700 Organization: None to speak of Lines: 19 Message-ID: <874krpuzvf.fsf@nosuchdomain.example.com> References: <8c6495f9-6139-464e-ac8f-4eac27a92776@googlegroups.com> <60d0f73c-8588-4673-a48d-e5c4cc726196@googlegroups.com> <87blm1wam0.fsf@nosuchdomain.example.com> <5ed95cf6.762046@news.xs4all.nl> <87h7vqv345.fsf@nosuchdomain.example.com> <02e52edb-b1b0-4226-962e-c6bfba0167cdo@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="b656610d00cff2031007d01ed08d3ec3"; logging-data="9519"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/BpBoEGV2f2hjNwzypTP17" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cancel-Lock: sha1:oQGCJTMYVPL5N6mvyONm/7pGioQ= sha1:pLyyMVz6v31ybBPW3QK/Jak9wPA= Xref: csiph.com comp.lang.c:152676 Malcolm McLean writes: > On Friday, 5 June 2020 00:11:01 UTC+1, Keith Thompson wrote: [...] >> It's not at all clear what the OP's expections were. They said >> they had "just noticed" that sizeof('a') and sizeof(1+=1) yield >> different results in C and C++. (Both differences are well known, >> and rarely affect real programs; how often do you apply sizeof to a >> constant expression? And in principle they can yield the same result >> if sizeof(int)==1, but that's rare and not particularly relevant.) >> > THe example was sizeof(1 != 1). sizeof(1 += 1) is illegal, but would > resolve to sizeof(int) if it were allowed. Yeah, that was just a typo on my part. -- 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 */