[Snowball-discuss] floating labels in generated C

From: Martin Porter (martin_porter@softhome.net)
Date: Wed Feb 20 2002 - 11:08:46 GMT

(Vineet, it would be best if your messages were posted into
snowball-discuss, as here.)

Vineet Gupta notes:

>.... some minor problems:
>1. The snowball compiler does not put a semicolon after a label if there is
>no statement after it, for example
> lab5:
> }
>My compiler, Visual C++ on Windows 2000, gives an error, which I fix by
>adding a semicolon:
> lab5:
> ;
> }

I have put a delicate adjustment into the ANSI C generator to add in a line
with the semicolon in just these circumstances. A few, but not all, of the
stem.c files are thereby affected. (Should be on sourceforge in a few hours.)

In ANSI C, labels attach to commands, and it is incorrect to leave them
floating at the ends of blocks. I was aware of this, but since gcc does not
complain, I thought I could get away with it in all circumstances. Clearly not.

Presumably you could fix the problem by adding ';' after every label, or
indeed before every block closure, but how ugly!

Viveet raises a number of other points which will be addressed in due course,


Snowball-discuss mailing list

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