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: sizeof(x) / sizeof(x[0]) Date: Sat, 14 Jan 2017 15:55:19 -0800 Organization: None to speak of Lines: 17 Message-ID: References: <1420cd8f-e5cb-4a8f-93e6-d80a8b050650@googlegroups.com> <388bc5e2-01fd-49a3-8814-9e438d1ae07c@googlegroups.com> <201446a6-fb70-4e5a-b5ed-fca27d9c8551@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="a3056e3d6a9ef9101ceee550b325befe"; logging-data="13715"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/a1qjO4ZtlHr+Bgfl7LOtb" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:vr4llgXWeloy2lqNPEuMO9vsXrs= sha1:7oFSklltL6FcUQtA1LKIdkUWjjY= Xref: csiph.com comp.lang.c:101828 "Fernando D. Bozzo" writes: > El sábado, 14 de enero de 2017, 13:43:16 (UTC+1), Alla _ escribió: > >> Here is the macro (I have not posted it assuming people know it, sorry): >> #define ARRAY_SIZE(x) ( sizeof(x) / sizeof(x[0]) ) > > Oh, surely all people here knows this, but I'm new :) That's certainly a reasonable definition for that macro, but since there's no such macro in the standard it is important to be explicit. Minor variations in how it's defined could be significant. -- 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"