[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: [CPROG] stream problemer



Anders Melchiosen skrev:

>sslug@sslug skrev:

>> Jeg kender flere der ville finde ovenstående "Bad Programming
>> Practice"

>Jah, til at starte med får du vist ikke nedlagt det objekt, du laver
>med new (og dermed ikke lukket filen) ?

Jo jeg gør!-):
destructoren til std::basic_filebuf<...> *skal* kalde close().
Da bufferen skal være et privat objekt i std::basic_ofstream<...> sker 
dette når std::basic_ofstream<...> bliver (implicit) deleted. Dette sker i 
eksemplet ved programmets termination.

Men korrekt!-):
Den underliggende fd vil være åben og den allokerede hukommelse 
tilsvarende brugt indtil da.

I det minimerede programs tilfælde kan det af "æstetiske" grunde måske? 
forsvares - i et pædagogisk eksempels tilfælde bør det nok kaldes "Bad 
Programming Practice"!

mvh
Nils Åke Ljunggren


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 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] *