Bram Moolenaar <> wrote:

> Hello Vimmers,
> For a long time Vim code was made to be compiled with ANSI C (also known
> as C89 and ISO C90).  This means it can also be compiled on very old
> systems.  And since it wasn't too much work to support it, that was the
> choice.
> Now that we are adding checks for C89 compliance, it turns out that we
> already are using some C99 features, such as the "long long" type.
> Also, many libraries produce warnings when enforcing C89.  That means
> using C89 is starting to become a hassle.  So, the question comes up: is
> it still worth it?
> If you CANNOT build Vim with a C99 compiler, please speak up!
> If I don't hear about such cases, I think we are better off using C99 as
> the standard.
> Note that if we go with C99, we still need to decide what features we
> will actually use, since C99 compliance was lacking for quite a while
> (esp. in MS-Visual C).  That's not going to make this easier.

I would welcome C99.

gcc-4.5 has full support of C99, but many C99 features
were supported much earlier than that, see [1].

It's less clear to me when C99 features were introduced
in Visual studio. C99 support was lagging in Visual Studio.

I just thought about C99 a few days ago, when I saw a colleague
having a crash with vim, because he did not compile it with
-D_FORTIFY_SOURCE=1. The ugly compilation option won't
be needed with C99, as we can then use flexible array member [2]
i.e. replace things like:

  struct buffblock
      buffblock_T    *b_next;    /* pointer to next buffblock */
      char_u    b_str[1];    /* contents (actually longer) */


  struct buffblock
      buffblock_T    *b_next;    /* pointer to next buffblock */
      char_u    b_str[];

It makes the intent clear to the programmer and to the compiler
that the last field array b_str can have any size. Vim should
then not crash anymore when using with -D_FORTIFY_SOURCE=2
(default in gcc on Ubuntu). Flexible array members are supported
since gcc-3.0 i.e. since 2001 according to [3].



You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit

You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Raspunde prin e-mail lui