[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] c++ Brug af using



fredag 23 marts 2007 10:17 skrev Michael Rasmussen:
> On Fri, 23 Mar 2007 09:55:39 +0100
> "E. Sjørlund" <sslug@sslug> wrote:
> 
> > I den bruges en using std::cin; using std::cout; osv i modsætning til
> > Bjarne Stoustrups hurtige using std
> >
> Du mener vel: using namespace std;
> 
> > Er der nogen fordel ved at definere præcis hvilke dele af std man
> > bruger, eller er det blot forfatteren, som mener, at det giver et
> > bedre overblik (det gør det jo til dels).
> >
> Når source er oversat til maskinlæsbar kode, tror jeg alle referencer
> til std namespace, der ikke bliver kaldt i programmet, er optimeret
> væk. Inkluder du derfor roligt hele std namespace i dine programmer.

Det er rigtigt. Fordelen er entydighed, og at man ikke umiddelbart kommer til 
at bruge ting man ikke regner med, fordi de tilfældigvis ligger i namespacet.

> Et lille tip: Anvend aldrig denne notation i header filer. Her bør man
> altid angive fulde referencer.

bør == skal i denne sammenhæng.

Mht "regler", kan jeg på det varmeste anbefale 
C++ Coding Standards (se 
http://www.gotw.ca/publications/c++cs.htm)
som er _rigtigt_ god.

Jeg ved ikke hvordan den er at læse når man går igang med C++, men man skal 
nok læse den inden der er gået alt for lang tid.

Mvh

Mads

-- 
Mads Bondo Dydensborg.                               sslug@sslug
Smoking kills. If you're killed, you've lost a very important part of your
life.  
            - Brooke Shields, during an interview to become spokesperson for a
                                               federal anti-smoking campaign.



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2007-04-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *