> Jon Berndt wrote:
> > Are there any reasons to choose one method over the other in
> the declaration
> > of local variables that are used each frame?
> >
> > Here are some examples. Note that this hypothetical routine
> would be called
> > each pass through the EOM (for example):
> >
>
> > ============= Method 2)
> >
> > MyClass::Calculate(double xyz)
> > {
> > ... <calculations> ...
> >
> > if (price_of_tea_in_China > 0.45) {
> > double abc = xyz*1.5;
> > }
> >
> > ImportantValue = abc+24.0;
> >
> > ... <more calculations> ...
> > }
>
> This one wouldn't work. abc is only known within the if test.
>
> Erik
Oops. You're sharp! :-)
I meant this, then:
> > ============= Method 2)
> >
> > MyClass::Calculate(double xyz)
> > {
> > ... <calculations> ...
> >
> > if (price_of_tea_in_China > 0.45) {
> > double abc = xyz*1.5;
> >
> > ImportantValue = abc+24.0;
> > }
> >
> > ... <more calculations> ...
> > }
Jon
_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel