Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 May 1997 09:11:41 -0700
From:      "Jin Guojun[ITG]" <jin@george.lbl.gov>
To:        freebsd-bugs@FreeBSD.ORG, joerg@FreeBSD.ORG
Subject:   Re: gnu/3554
Message-ID:  <199705091611.JAA28108@george.lbl.gov>

next in thread | raw e-mail | index | archive | help
> Synopsis: cc failed on deafult <= default
>
> That's actually legal C code.

Theoretically, it is correct; but it is awkward. This kind program bug is
very hard to find out without checking every word of the code. cc does NOT
provide any information/warrning on it, then how do you know the default
has been a typo? In the huge code program, where do you look for the bug?

The cc could be a little smart to do this:

	if "default:" is found in a switch block, then no further check.
	otherwise, if no "default:" is in a switch block, but some similar
	label is found, which may be a type, gives a warning:

warning: default is not defined in this switch block, but a similar lable
	was found. This may be a typo.

Does this look better?

-Jin




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705091611.JAA28108>