[haiku-development] Re: c++ struct assignment like in c?

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 27 Mar 2011 22:26:53 +0200

Clemens <clemens.zeidler@xxxxxxxxxxxxxx> wrote:
> ps2_dev ps2_device[PS2_DEVICE_COUNT] = {
>       {
>               .name = "input/mouse/ps2/0",
>               .active = false,
>               .idx = 0,
>               .result_sem = -1,
>               .command = standard_command_timeout
>       }
> };
> c++ complains about the dots :-(

And the names, and the equals :-)
This is, unfortunately, not valid in C++, you either have to resort to 
something like Alex suggested, or you could just remove the ".name = " 
stuff, and keep a standard initializer list - less verbose, but it'll 
work just fine.

Bye,
   Axel.


Other related posts: