Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: usecases of void foo(char **b) {} Date: Sun, 06 Nov 2016 14:06:44 -0800 Organization: None to speak of Lines: 41 Message-ID: References: <8737j7gd87.fsf@bsb.me.uk> <87twbmfzah.fsf@bsb.me.uk> <87fun6f1j4.fsf@bsb.me.uk> <877f8hgb0p.fsf@bsb.me.uk> <87eg2pedkx.fsf@bsb.me.uk> <87wpghcu23.fsf@bsb.me.uk> <877f8gx44n.fsf@bsb.me.uk> <878tswb89s.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="d0d2eb2bf0baae43eeb9ce130bb24749"; logging-data="22948"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Ijm2l5dUWbM1ot3h5nDTg" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:NCCnEOy7gVEr7vo6BMTGBrndxA0= sha1:1+LyF9RbjS2NOSfK7X+VfZ3yxYA= Xref: csiph.com comp.lang.c:95988 Ben Bacarisse writes: > Keith Thompson writes: > >> Richard Heathfield writes: >> [...] >>> Uh, the only rule (and it isn't a particularly arcane rule) is that, >>> when used in a value context, the name of an array is treated as a >>> pointer to its first element. That's not /such/ a big deal, surely? >> [...] >> >> Warning: I'm about to pontificate at some length over something >> that's not greatly significant. > > ... and I'm about to make it worse ... > >> I've seen the rule stated that way before. It's not terribly far >> from being correct, but it does misstate the rule. >> >> The rule, as I know you know, is that an expression of array type >> (not just the name of an array) is "converted" ("adjusted" would >> have been a better term) to be an expression of pointer type, >> unless it's in one of three contexts: the operand of sizeof, the >> operand of unary "&", or a string literal in an initializer used >> to initialize an array object. That's still not particularly arcane. > > That list now includes the operand of _Alignof (unless that changed in > the final adjustments between draft n1570 and C11). > > It did change between N1570 and C11. The inclusion of _Alignof was an error in N1570. In fact, _Alignof, unlike sizeof, can only be applied to a parenthesized array type, not to an array expression. The published C11 standard corrected that error. (The reason for that gratuitous difference is another matter.) -- 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"