stgructure initialization stype shows as error

Andreas Pakulat apaku at gmx.de
Fri Aug 29 15:12:04 UTC 2008


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.

Andreas

-- 
You will have a long and unpleasant discussion with your supervisor.




More information about the KDevelop-devel mailing list