stgructure initialization stype shows as error

dizzy dizzy at roedu.net
Fri Aug 29 07:57:43 UTC 2008


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.

-- 
Dizzy
			"Linux is obsolete" -- AST





More information about the KDevelop-devel mailing list