SV: [Icc-avr] Switch thing

Bengt Ragnemalm benra at imt.liu.se
Wed Apr 11 05:43:42 PDT 2007


I say horrible coding if at all possible.

 

Do you mean that you have two cases that you may enter, case 1 and case 2
there case 1 may also want to execute the code in case 2?

 

I suggest you put the code for the cases in functions:

 

Switch(status)

{

 Case 1:         Case1func();

                      if(Option enabled)

                        Case2func()

                      break;

 Case 2:         Case2func();

break;

}

 

/Bengt

 

  _____  

Från: icc-avr-bounces at imagecraft.com [mailto:icc-avr-bounces at imagecraft.com]
För Steven Lose
Skickat: den 11 april 2007 14:07
Till: Discussion list for ICCAVR and ICCtiny Users. You do NOT
needtosubscribeto icc-announce if you are a member of this.
Ämne: [Icc-avr] Switch thing

 

Hi.

 

Is the following ok, or just bad coding?

If bad coding, how is it done the “right way”?

 

 

Switch(status)

{

 Case 1:         do lot of stuff

                      If(Option enabled)

                      {

 Case 2:         Do optional thing

}

break

}

 

Med venlig hilsen / Best regards / mit freundlichen Grüßen

EC POWER A/S

Steven Lose

Software Ingeniør

Tlf.: +45 87434100

Direkte tlf. +45 58286608

Email: sl at ecpower.dk <blocked::mailto:bsl at ecpower.dk> 

www.ecpower.dk

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070411/a3bc53df/attachment-0001.html


More information about the Icc-avr mailing list