Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 16 Dec 2012 09:50:50 -0600 Message-ID: <50CDEDDF.2214@mindspring.com> Date: Sun, 16 Dec 2012 10:50:55 -0500 From: pete Reply-To: pfiland@mindspring.com Organization: PF X-Mailer: Mozilla 3.04Gold (WinNT; I) MIME-Version: 1.0 Newsgroups: comp.lang.c Subject: Re: some well known stupidness in c99 References: <691430a0-0d95-40ac-8ca4-5ceab7db74db@googlegroups.com> <6e37296c-acf0-4fb7-8370-9ad3fe80c12e@googlegroups.com> <95e6588e-0464-4e23-b18f-c88ee17a6f94@googlegroups.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 23 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 4.154.218.66 X-Trace: sv3-uDSZA49TWwRDkLnz3n0dJN3eRNc/CrADwLwMNl9KwDUmbG09RJJdKIo/1CijiL3FKkK4P1ZYKd6//xI!TPrtkW84FPo6n4XmVQ4GEMrn5QwQVHzaJTJWkzJrwzMzhOmiGIzd48gsvEPJtzkE/35oQekS2GmP!6CUHyTxKIQ== X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2179 Xref: csiph.com comp.lang.c:29334 James Kuyper wrote: > > On 11/19/2012 08:21 AM, James Kuyper wrote: > > On 11/19/2012 06:35 AM, BartC wrote: > ... > >> #define lengthof(x) (sizeof(x)/sizeof(x[0])) > That's not the > problematic case. It's pointers that point at the first element of an > array (such as "Hello world!") that lengthof() doesn't handle in the > desired fashion. I was just reading a post by Shao Miller, with words to the effect that lengthof("Hello world!") works just fine. I would have used a different name for the macro, so as not to confuse the meaning of the macro with the meaning of how the standard defines the length of a string. What did you mean by "doesn't handle in the desired fashion" ? -- pete