Re: C syntax problem with C99 initializers.

2007-03-19 Thread Mike Williams

On 19/03/2007 17:39, David Brown wrote:

Martin Krischik wrote:

Am Montag 19 März 2007 schrieb David Brown:

A macro like this:

  #define FOO ((fooy) { field: 4 })

Whenever I thougth I saw it all C comes with another suprise. What
the heck is this good for?


It is a constant structure, useful, in this case, as a macro to
indicate a constant value.  The "field:" thing is gcc, the proper C99
syntax is:

   { .field = 4 }

But what is confusing vim is the braces inside of the parens.  As Bram
mentioned in another email, this can be disabled, but it makes vim not
able to detect unclosed parens.


Have you tried the alternate C syntax highlight file here?

http://www.vim.org/scripts/script.php?script_id=234

TTFN

Mike
--
At least the doctors find me fascinating.



Re: C syntax problem with C99 initializers.

2007-03-19 Thread David Brown
Martin Krischik wrote:
> Am Montag 19 März 2007 schrieb David Brown:
>> A macro like this:
>>
>>   #define FOO ((fooy) { field: 4 })
>
> Whenever I thougth I saw it all C comes with another suprise. What
> the heck is this good for?

It is a constant structure, useful, in this case, as a macro to
indicate a constant value.  The "field:" thing is gcc, the proper C99
syntax is:

   { .field = 4 }

But what is confusing vim is the braces inside of the parens.  As Bram
mentioned in another email, this can be disabled, but it makes vim not
able to detect unclosed parens.

Dave



Re: C syntax problem with C99 initializers.

2007-03-19 Thread Martin Krischik
Am Montag 19 März 2007 schrieb David Brown:
> A macro like this:
>
>   #define FOO ((fooy) { field: 4 })

Whenever I thougth I saw it all C comes with another suprise. What the heck is 
this good for?

Martin
-- 
Martin Krischik
mailto://[EMAIL PROTECTED]


pgpqr1CVAZVlY.pgp
Description: PGP signature


Re: C syntax problem with C99 initializers.

2007-03-19 Thread Bram Moolenaar

David Brown wrote:

> A macro like this:
> 
>   #define FOO ((fooy) { field: 4 })
> 
> causes vim to highlight the braces (in an angry fashion), and seems to
> cause it consider all of the remaining braces in the file to be in
> error as well.
> 
> Any ideas?

Highlighting curly braces inside parenthesis is about the only way to
detect a missing closing parenthesis.

You can disable this with:
:let c_no_curly_error = 1

You won't be able to see missing parenthesis then.  Blame C99 to make a
syntax that's hard to check.

-- 
LAUNCELOT: I am, sir. I am a Knight of King Arthur.
FATHER:'Mm ... very nice castle, Camelot ... very good pig country
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


C syntax problem with C99 initializers.

2007-03-19 Thread David Brown
A macro like this:

  #define FOO ((fooy) { field: 4 })

causes vim to highlight the braces (in an angry fashion), and seems to
cause it consider all of the remaining braces in the file to be in
error as well.

Any ideas?

Thanks,
David Brown