who can tell me is it all right?

Michael Torrie torriem at chem.byu.edu
Mon Jun 12 06:46:05 MDT 2006


On Mon, 2006-06-12 at 15:39 +0800, Laurent R wrote:
> Hi,
>   I reviewed some codes from one project. I think it is not proper, but I 
> don't know the reason. Who can help me to explain it?
>   I don't think it is proper that 'break' exists in the bracket. It seems 
> not good that it remains in the local variable domain.
>   Do you think it is all right?

Should be fine.  Break always exists the nearest loop or switch block.
For example, it is quite common to break out of a for loop from inside
of an if statement:

for (;;) {
	if(condition) {
		do_things();
		break;
	}
	if(something_else) {
		do_morethings();
		continue;
	}
	do_stuf();
}

> 
> EXAMPLE:
>   switch (var)
> {
> case 1:
>      {
>          unsigned char ucTemp;
>          ....(some operation)....
>          break;
>      }
> case 2:
>      {
>          unsigned char ucTemp;
>          ....(some operation)....
>          break;
>      }
> default:
>     break;
> }
> 
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE! 
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> 
> 
> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
> */
> 



More information about the PLUG mailing list