[Snowball-discuss] Compiling with VC++ 6?

From: J Smith (jsmith@tutorbuddy.com)
Date: Thu Apr 18 2002 - 18:15:03 BST

A month or two ago, I released a PHP extension that provided access to the
stemmers created by Snowball. The extension worked fine for UNIX-like systems
using gcc, but recently I've started porting the extension to Windows
platforms and have been stuck. (Since PHP is supposed to provide a pretty
decently portable language like Perl, I figured I had better make the
stemming extension available on as many commonly used platforms as I could.)

However, I'm having problems getting the extension to compile with VC++ 6 on
Windows 2000. (Which is the only Windows platform I use.) The problems seem
to stem (no pun intended) from the fact that it seems to cling to ANSI/ISO C
standards a bit more than gcc does.

The main problem I'm getting: arrays with a length of zero. I'm not completely
sure if this was part of the '85 C standard, as I don't have a copy readily
available, but according to the C99 draft standard, arrays declared with
constant expressions must be declared using integer values greater than zero.
(The pertinent section of the draft standard is, para 1.)

In many of the stemmers we see declarations and initializations like this
(from the Dutch stemmer, line 17):

static symbol s_0_0[0] = { };

I never had problems before with code like this, as gcc basically ignores it,
although if you compile with -pedantic if does produce the following

dutch.c:17: warning: ISO C forbids zero-size array `s_0_0'
dutch.c:17: warning: ISO C forbids empty initializer braces

On VC++ 6, these warnings become errors:

dutch.c(17) : error C2466: cannot allocate an array of constant size 0
dutch.c(17) : error C2059: syntax error : '}'

Is there anything that can be done to either shut VC++ up and make it compile
(I'm so used to gcc now I'm at a loss with VC++'s options and make system) or
to rework Snowball to eliminate these zero-sized arrays?



Snowball-discuss mailing list

This archive was generated by hypermail 2.1.3 : Thu Sep 20 2007 - 12:02:41 BST