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: C wish list Date: Fri, 22 Mar 2019 11:54:22 -0700 Organization: None to speak of Lines: 32 Message-ID: References: <11b51bdf-7847-40fc-bdf5-b3777f41b4da@googlegroups.com> <18RkE.296542$DH4.255445@fx24.am4> <2J7lE.185089$1p7.119303@fx05.am4> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="7987eac78b6ba844db2ada674c778ee3"; logging-data="1145"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/QdjQ//M/aJr3UyN5ZXLg3" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:kxzY19ZVhxkfRnfw49XO3i45b/g= sha1:2zNk3de7pmiTQjYRKzTLYdvemHk= Xref: csiph.com comp.lang.c:142254 Bart writes: [...] > You are saying that here: > > int32_t x = f(); > int32_t y = >8> > > it is acceptable to use a 64-bit version of x, even though x is only 32 > bits, because it's using a value left over in a 64-bit register from > some immediately prior calculation of x. > > If that is actually what C allows, then it is even crazier than I'd > already thought, and that is saying something. > > If you are saying that that is only allowed because of UB, then that > does little to change my opinion. It is certainly more crazy stuff that > the OP is complaining about. If the evaluation of the expression has undefined behavior, then yes, literally anything is allowed. That's what undefined behavior means. I'm not sure why you chose x>>8 as your example. That never has undefined behavior. If x is negative, the result is implementation-defined; otherwise, the result is well defined. I think you know what "undefined behavior" means in C, but either you refuse to accept it or you pretend to refuse to accept it. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */