Re: initializer must be constant error bug?



"Mike H." <mikehg_67@xxxxxxxxx> wrote in message
news:43d5a8db$0$9239$6d36acad@xxxxxxxxxxxxxxxxxxxxxxxx
>
> I'm getting the error " initializer must be constant" from code such as:
>
> void foo(int x, int y, int w, int h)
> {
> RECT rc = { x,y,w,h };
> }
>
> This should work for auto variables, correct?

Nope, not in C89. In both C99 and C++ that would be correct.

--
Unicals Group -- Embedded C++ for Your IP Cores
http://www.unicals.com


.



Relevant Pages

  • Help in Java swings(internal Frame)
    ... public int getSize() ... public void valueChanged{ ... private JScrollPane scrollPane1; ... public class PeakContainer extends JInternalFrame ...
    (comp.lang.java.programmer)
  • problem in java swings
    ... public int getSize() ... public void valueChanged{ ... private JScrollPane scrollPane1; ... public class PeakContainer extends JInternalFrame ...
    (comp.lang.java.programmer)
  • [PATCH,RFC 2.6.14 09/15] KGDB: SuperH-specific changes
    ... This adds basic support for KGDB on SuperH as well as adding some architecture ... -static int kgdb_uart_getchar ... -static void kgdb_uart_putchar ... * The command-line option can include a serial port specification ...
    (Linux-Kernel)
  • ToolTips in a View and TTN_NEEDTEXT
    ... extern int g_minWorkPeriod; ... void CDayView::CreateAllFonts ... void CDayView::DrawDayLog(CDC* pDC) ... BOOL CDayView::TimeToY ...
    (microsoft.public.vc.mfc)
  • [PATCH 6/20] FRV: Fujitsu FR-V CPU arch implementation part 4
    ... +static void register_irq_proc (unsigned int irq); ...
    (Linux-Kernel)