Re: Whats the difference? string and std::string
From: Gavin Deane (deane_gavin_at_hotmail.com)
Date: 11/23/03
- Next message: ma740988: "Re: outputting data"
- Previous message: Ulrich Eckhardt: "Re: Why are my private class members visible?"
- In reply to: Robert W Hand: "Re: Whats the difference? string and std::string"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 23 Nov 2003 07:28:39 -0800
Robert W Hand <rwhand@NOSPAMoperamail.com> wrote in message news:<8v31sv44vq9aqnp6bfa1hqq2i8sish1gjg@4ax.com>...
> On 20 Nov 2003 06:58:28 -0800, deane_gavin@hotmail.com (Gavin Deane)
> wrote:
>
> >Robert W Hand <rwhand@NOSPAMoperamail.com> wrote in message news:<m49prvgmap6nhjm0cm6o1q0sp8e2lhd2pv@4ax.com>...
> >
> ><snip>
> >
> >> >Also what is the standard using namespace or std::?
> >>
> >> Both, although many would prefer avoiding the directive. In
> >> particular, you should not use the directive in a header.
> >
> >Just to clarify for the OP ...
> >
> >In a header you should avoid using directives (eg using namespace
> >std;) _and_ avoid using declarations (eg using std::string;). Always
> >fully qualify the name, ie everywhere you have a string, declare it as
> >std::string my_string;
> >
> >Otherwise you force anyone who includes your header to accept the
> >using declaration or directive, whether they want it or not.
>
> Sorry, that statement is not quite correct. For example, common style
> allows using declarations in class definitions that are found in
> header files.
>
> I believe that we are both writing about dumping names from a
> namespace into the global namespace with little or no warning to
> client programmers. Such a practice leads to the possibility of name
> clashing. In very large programs, name clashing is a serious problem.
> I agree that using declarations and using directives can be misused as
> you point out.
All agreed. Thanks for the further clarification Bob.
GJD
- Next message: ma740988: "Re: outputting data"
- Previous message: Ulrich Eckhardt: "Re: Why are my private class members visible?"
- In reply to: Robert W Hand: "Re: Whats the difference? string and std::string"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|