Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #106069
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Two C code questions |
| Date | 2017-03-14 11:49 -0700 |
| Organization | None to speak of |
| Message-ID | <lnzignitgp.fsf@kst-u.example.com> (permalink) |
| References | <oa7oru$rkf$1@dont-email.me> <468c93a0-7b2d-4eab-8266-39737867b9ac@googlegroups.com> |
John Bode <jfbode1029@gmail.com> writes:
> On Monday, March 13, 2017 at 10:45:53 PM UTC-5, Mehdi Amini Valashani son of Bahram wrote:
[...]
>> int main(void)
>> {
>> uint64_t ui[N] = {0};
>>
>
> For C89 and earlier, array dimensions must be *constant expressions*; i.e.,
> something that can be evaluated at compile time (integer literals, sizeof
> expressions, macros that expand to either literals or sizeof expressions,
> arithmetic expressions that involve any of the previous, etc.).
>
> A variable declared as "static const" is *not* a constant expression - its
> value is not evaluated at compile time.
>
> C99 introduced variable-length arrays, whose size doesn't have to be
> established until run time; if you compiled that code under a C99 compiler,
> it should work.
No, C99 doesn't allow VLAs to be initialized (nor does C11).
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
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"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Two C code questions MehdiAmini <atorrses@gmail.com> - 2017-03-14 07:15 +0330
Re: Two C code questions Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-03-13 22:13 -0600
Re: Two C code questions Ian Collins <ian-news@hotmail.com> - 2017-03-14 17:16 +1300
Re: Two C code questions Ike Naar <ike@iceland.freeshell.org> - 2017-03-14 07:20 +0000
Re: Two C code questions MehdiAmini <atorrses@gmail.com> - 2017-03-14 12:01 +0330
Re: Two C code questions Ike Naar <ike@iceland.freeshell.org> - 2017-03-14 19:23 +0000
Re: Two C code questions Keith Thompson <kst-u@mib.org> - 2017-03-14 12:40 -0700
Re: Two C code questions scott@slp53.sl.home (Scott Lurndal) - 2017-03-14 12:44 +0000
Re: Two C code questions Keith Thompson <kst-u@mib.org> - 2017-03-14 08:53 -0700
Re: Two C code questions MehdiAmini <atorrses@gmail.com> - 2017-03-15 14:05 +0330
Re: Two C code questions John Bode <jfbode1029@gmail.com> - 2017-03-14 10:38 -0700
Re: Two C code questions Keith Thompson <kst-u@mib.org> - 2017-03-14 11:49 -0700
Re: Two C code questions John Bode <jfbode1029@gmail.com> - 2017-03-14 14:14 -0700
csiph-web