[Snowball-discuss] Problem with compiling Snowball under Visual C++
James Aylett
james@tartarus.org
Sun Nov 2 12:42:02 2003
On Fri, Oct 31, 2003 at 04:45:20PM -0000, Charlie Hull wrote:
> 1. All the individual stemmers are held in files called 'stem.c'. This means
> that Visual C++ attempts to compile them into object files called 'stem.obj'
> and then gets most confused at link time. I can get round this by some
> automated renaming of the sources so it's not a huge problem.
Are you trying to build this within a VC++ workspace, or just using
the command line tools directly?
> 2. In most of the stem.c files there are structures as follows:
>
> switch(x)
> {
> ...
> case 12:
> {
> if(something) then goto lab4;
> [do something to be skipped]
> lab4: <--- compiler error here "missing ';' before '}"
> }
> break;
> ...
> }
>
> If I add a ';' just after the label then the compiler is happy. Does anyone
> have any comment?
I don't have K&R here at home, but the thing that strikes me is that a
label probably labels a /statement/, and that the above code doesn't
do that. So adding the ';' after lab4 would be correct (if I'm right
about that). If the above is correct, VC++ is probably making the
assumption that there'll be a statement after a label.
I imagine there's a good reason why the skipped section isn't just
wrapped in a conditional - I haven't looked at the C generator within
Snowball. It shouldn't hurt anything for it always to output an empty
statement (just the ';') after any label it generates, although poor
quality compilers might generate less efficient code in the above
case.
James
--
/--------------------------------------------------------------------------\
James Aylett xapian.org
james@tartarus.org uncertaintydivision.org