🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.objects
Article #15316

Re: Jeszcze o C++ templates i ich zwiazku z ....

#15316
From: Muchomor
Date: Mon, 04 Sep 2006 21:56
37 lines
2534 bytes
"A.L." <alewando@fala2005.com> wrote

>"For one thing, templates hurt the C++ compiler's ability to generate 
>efficient code" ......
> " C++ templates hide your intentions from the compiler: did you mean type 
> abstraction? Did you mean a
> syntax extension? Did you mean constant-folding or compile-time code
> generation? The compiler doesn't know, so it has to just blindly
> apply the copy-and-paste strategy and then see what happens."

Wytknijcie mi gdzie sie myle, ale dla mnie ten fragment nie ma krzty sensu. 
Autor tutaj najwyrazniej strzela sobie samoboja. Jesli przyjac - za 
autorem - , ze kompilator stosujac copy&paste z czegos takeigo :

template<typename T> void Fun(T val)
{
    std::cout << "Val = " << val << "\n";
}

wygeneruje np. 2 funkcje

void Fun(int  val);    (1)
void Fun(double val); (2)

to gdzie tu szablony "hurt the C++ compiler's ability to generate efficient 
code" ?
Czym sie to bedzie roznic od sytuacji gdy programista sam sobie napisze 
funkcje (1) i (2) zamiast szablonu?
Kompilator bedzie szczesliwszy? Nie sadze... Pomijam tu w ogole kwestie 
optymalizacji konkretnych kompilatorow bo o tym autor chyba tez zapomnial. A 
tak ogolnie to caly ten "artykul" to mi wyglada na hymn pochwalny ML na tle 
przypadkowo dobranej ofiary. Nie dowiedzialem sie co jest nie tak z 
szablonami C++, za to wiem czemu ML jest taki fantastyczny.

pzdr
Muchomor
Technical Details
Message-ID: <9624a$44fca0f9$57cffbdc$22240@news.chello.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!newsfeed.pionier.net.pl!news-fra1.dfn.de!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.freenet.de!newsfeed01.chello.at!newsfeed02.chello.at!news.chello.pl.POSTED!not-for-mail
References: <0elmf2h54pl11i82jrlrjeifeaue4np2i6@4ax.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!newsfeed.pionier.net.pl!news-fra1.dfn.de!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.freenet.de!newsfeed01.chello.at!newsfeed02.chello.at!news.chello.pl.POSTED!not-for-mail
Reply-To: "Muchomor" <muchomor_w_kropkiCUT_THIS@gazeta.pl>
From: "Muchomor" <muchomor_w_kropkiCUT_THIS@gazeta.pl>
Newsgroups: pl.comp.objects
References: <0elmf2h54pl11i82jrlrjeifeaue4np2i6@4ax.com>
Subject: Re: Jeszcze o C++ templates i ich zwiazku z ....
Date: Mon, 4 Sep 2006 23:56:06 +0200
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
X-RFC2646: Format=Flowed; Original
Message-ID: <9624a$44fca0f9$57cffbdc$22240@news.chello.pl>
X-Complaints-To: abuse@chello.pl
Organization: chello.pl
Lines: 40
NNTP-Posting-Host: 87.207.251.220 (87.207.251.220)
NNTP-Posting-Date: Mon, 04 Sep 2006 23:56:09 +0200
X-Trace: 9624a44fca0f9f26a5e7922240
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit