Missing warning opportunity - code after break;

Soul Studios matt@soulstudios.co.nz
Tue Jun 20 02:37:00 GMT 2017


Just noticed this:
while(something)
{
	// stuff

	if (num_elements == 0)
	{
		break;
		--current_group;
	}
}

doesn't trigger a warning in GCC 5.1, 6.3 and 7.1. The line after 
"break;" is unused, probably should be before the break, ie. user error.

Matt Bentley



More information about the Gcc mailing list