Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: C++ features for C Date: Tue, 15 May 2018 11:59:53 -0700 Organization: None to speak of Lines: 54 Message-ID: References: <11edbfd7-461d-4579-8ac7-a9e84a6b7630@googlegroups.com> <7b110d3e-ddb5-42a0-af99-aa5b0cb30832@googlegroups.com> <13efc313-d10c-4357-9aa7-6fa55b09d948@googlegroups.com> <87po1xi2n1.fsf@bsb.me.uk> <87k1s5hror.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="fd2ef88f3973fbdcdd5cf6f7f328cfd4"; logging-data="13360"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+TBQQ44DMdd/IuVYaATXqY" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:rmdq9pHmpnDZoGvFEZI/SCe/0zs= sha1:Zufr3JSLqWczSwb3u56DDPWtdoU= Xref: csiph.com comp.lang.c:130622 bartc writes: > On 15/05/2018 18:23, Keith Thompson wrote: >> bartc writes: >>> On 15/05/2018 16:19, Ben Bacarisse wrote: >>>> bartc writes: >>>>> (My compiler tells me the first is 'unsigned char**' and the second is >>>>> 'unsigned char*'.) >>>> >>>> There is no "may" here -- they are of expressions of different types. >>>> The first type has type char (*)[4], not unsigned char **, and the >>>> second has type char *. I'm not sure where the unsigned comes from in >>>> your case. >>> >>> The special exception for & was not being applied to "...", as it is for >>> sizeof, so it just wrapped an extra pointer level around "...". >>> >>> The unsigned char is because I deliberately don't support plain char; it >>> must be either signed or unsigned rather than unspecified, and I chose >>> to make it unsigned. >> >> Please make it clear when you're talking about a language than C. > > Why isn't it C? You make it sound like having a third character type is > a really big deal. It isn't C because C has three distinct character types. I never said it was a "really big deal", just that it's how the language is defined. > Give me an example where it really matters (ie. having 'char' mapped to > 'unsigned char' or 'signed char', instead of it being an incompatible > type). And I don't mean just coercing a compiler into giving a warning > or error. > > Actually, have the compilers I tried don't really care. This: unsigned char *p = "abc"; is a constraint violation. C compilers that don't at least warn about it are non-conforming. (gcc by default is far more lax than I would prefer, but as you know by now it's possible to invoke it in a mode that causes to to at least try to be conforming. You also know by now that diagnosing a constraint violation with a non-fatal warning is permitted by the standard.) I'm not asking you to care about these facts, just to stop pretending you don't know them. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"