stgructure initialization stype shows as error

Hamish Rodda rodda at kde.org
Sun Aug 31 07:47:26 UTC 2008


On Saturday 30 August 2008 01:12:04 Andreas Pakulat wrote:
> On 29.08.08 19:45:11, Kishore wrote:
> > 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?
>
> As we don't support plain C I don't see the usefulness of the bugreport.
> I'd probably close it as "LATER" or "REMIND" anyway.

Or open a wish for plain C support, if we don't have one already.

Cheers,
Hamish.




More information about the KDevelop-devel mailing list