Re: Code critique
"Kevin Goodsell" <usenet2.spamfr ee.fusion@never box.com> wrote in message
news:%DNcc.1916 7$lt2.5875@news read1.news.pas. earthlink.net.. .[color=blue]
> John Harrison wrote:[color=green]
> > "E. Robert Tisdale" <E.Robert.Tisda le@jpl.nasa.gov > wrote in message
> > news:40739564.2 010704@jpl.nasa .gov...
> >[color=darkred]
> >>John Harrison wrote:
> >>
> >>
> >>>>This should be avoided, but is not terrible,
> >>>>particularl y for small programs. Generally,
> >>>>import only what you need where you need it, so you could use
> >>>>
> >>>>using std::string;
> >>>>using std::vector;
> >>>>
> >>>>and you could even put these inside the functions that use those[/color][/color][/color]
items.[color=blue][color=green][color=darkred]
> >>>
> >>>It's not advice I would give.
> >>
> >>And just exactly what advice would you give?
> >>[/color]
> >
> >
> > Put all using ... at the top of the file, after all the includes.
> >[/color]
>
> Sure, that works well enough most of the time. But you /could/ restrict
> it to individual functions, if you wanted to.
>[/color]
I'm not denying it, it's just something I would almost never do.
Since generally speaking using ... refers to names that have been included
from a header file, it makes sense to me to put that declaration/directive
(which is it?) close to the header file it refers to.
john
"Kevin Goodsell" <usenet2.spamfr ee.fusion@never box.com> wrote in message
news:%DNcc.1916 7$lt2.5875@news read1.news.pas. earthlink.net.. .[color=blue]
> John Harrison wrote:[color=green]
> > "E. Robert Tisdale" <E.Robert.Tisda le@jpl.nasa.gov > wrote in message
> > news:40739564.2 010704@jpl.nasa .gov...
> >[color=darkred]
> >>John Harrison wrote:
> >>
> >>
> >>>>This should be avoided, but is not terrible,
> >>>>particularl y for small programs. Generally,
> >>>>import only what you need where you need it, so you could use
> >>>>
> >>>>using std::string;
> >>>>using std::vector;
> >>>>
> >>>>and you could even put these inside the functions that use those[/color][/color][/color]
items.[color=blue][color=green][color=darkred]
> >>>
> >>>It's not advice I would give.
> >>
> >>And just exactly what advice would you give?
> >>[/color]
> >
> >
> > Put all using ... at the top of the file, after all the includes.
> >[/color]
>
> Sure, that works well enough most of the time. But you /could/ restrict
> it to individual functions, if you wanted to.
>[/color]
I'm not denying it, it's just something I would almost never do.
Since generally speaking using ... refers to names that have been included
from a header file, it makes sense to me to put that declaration/directive
(which is it?) close to the header file it refers to.
john
Comment