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: Why does 'static' cause an error ? Date: Sun, 23 Apr 2017 16:45:05 -0700 Organization: None to speak of Lines: 30 Message-ID: References: <64abf1f2-1c45-4b1b-95cf-a88133813085@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="b06baaefdd2d8c25f7a310fe1662b016"; logging-data="29722"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/raDAfDxSu6aqAR+7blwqg" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:C4pUsuaJYZ4ygTwHDcAE00USa94= sha1:04XFFV0uSGCUhCutbSmosdfGcXw= Xref: csiph.com comp.lang.c:108380 bartc writes: > On 23/04/2017 19:17, fl wrote: [...] >> static const UART_HWAttrs uartHWAttrs[EK_UARTCOUNT] = { >> { >> .baseAddr = UART0_BASE, >> .intNum = INT_UART0, >> .intPriority = (~0), >> .flowControl = UART_FLOWCONTROL_NONE, >> .ringBufPtr = uartTivaRB[0], >> .ringBufSize = sizeof(uartTivaRB[0]) >> } >> }; [...] > Presumably one of those expressions isn't a compile time one. > > Add // in front of each. The error should go away. Then remove the //s > one by on until it comes back. (Watch out for a trailing comma on the > last uncommented line causing a syntax error.) > > (Maybe uartTivarRB isn't a flat array, but a pointer?) It doesn't matter. uartTivaRB[0] isn't a constant expression even if uartTivarRB is a "flat array". See N1570 6.6. -- 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"