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:46:54 -0700 Organization: None to speak of Lines: 44 Message-ID: References: <11b51bdf-7847-40fc-bdf5-b3777f41b4da@googlegroups.com> <18RkE.296542$DH4.255445@fx24.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/Exk7vJ5bF3ufDC2X4uXBC" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:WQCVHDygRvpoMofxmXzYYQdpEhg= sha1:5E2t4OEDv9BAbxT/7UERQO+wA/4= Xref: csiph.com comp.lang.c:142253 Bart writes: > On 22/03/2019 13:26, David Brown wrote: >> On 22/03/2019 12:39, Bart wrote: >> It is absolutely fine to have an operation whose result is sensible and >> defined when interpreted as one type, and not sensible, valid or defined >> when interpreted as another type. > > At what point would it generate nasal daemons? (Demons, not daemons.) In real life, never, because there's no such thing. The point is that the standard does not say that the program must not generate nasal demons. It's an exaggerated way of describing undefined behavior. (Surely you know this.) 1 << 31 (given 32-bit int) has undefined behavior. An implementation in which a program that evaluates 1 << 31 generates literal nasal demons would probably violate the laws of physics, but it would not violate the C standard. >>> So it's the next step up from assembly language. >> >> Nope. > > So what language is? (I don't count HLAs here.) Here's the difference. An assembly language program specifies a sequence of CPU instructions. The behavior of the resulting sequence is specified by the CPU, not by the assembler. A C program specifies behavior. C is lower level than many other languages, and higher level assembly language. I suppose you could, by stretching the point, say that C is "one level up" from assembly language. But there is a tremendous gulf between languages that specify CPU instructions and languages that specify behavior, and it's clear which side C is on. [snip] -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */