stgructure initialization stype shows as error
Kishore
kitts.mailinglists at gmail.com
Fri Aug 29 14:15:11 UTC 2008
On Friday 29 Aug 2008 1:27:43 pm dizzy wrote:
> On Friday 29 August 2008 09:59:14 Hamish Rodda wrote:
> > Hi,
> >
> > On Friday 29 August 2008 15:25:57 Kishore wrote:
> > > In C, structures can be initialized by either having comma separated
> > > values or by using member names as is shown below. Using the second
> > > method, shows a red error mark with kdevelop.
> > >
> > > struct SomeStruct
> > > {
> > > int a;
> > > int b;
> > > };
> > >
> > > struct SomeStruct someStruct =
> > > {
> > > a: 10, //<-- : on this line is marked in red
> > > b: 20
> > > };
> > >
> > > The above code is valid code but is not considered so by kdevelop.
> >
> > Is this the same for c++? (we don't officially support C yet)
>
> First of all there is no valid syntax like that with "a:". It may be some
> compiler extension. The valid C99 syntax to initialize struct/union members
> being named is using ".a" instead in his code example. Also, because this
> is C99 it's not C++03. Maybe C++0x will have it tho I fail to find that
> information in the WG21 papers.
I tried .a=10 as you mentioned and that compiles and works too. Still it
highlights the '.' in red. So if this is C standard and not C++ should i file
a bug?
--
Cheers!
Kishore
More information about the KDevelop-devel
mailing list