[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] compiler bug?



> Jeg ville dog tilføje en const qualifier:
> const CMatrix CMatrix::operator * (CMatrix& A);
> 
> returværdien (CMatrix)R er og bliver dog en auto
> variabel!

Hvilken betydning har dette? 
Det jeg er ude efter, er at kunne skrive meget kort
kode, fx. 
C=max(A*B-D)+3.4*A/C;
hvor altså A,B,C,D alle er float[N][N][N] matricer.
I sædvanlig C-stil vil dette blive nærmest ulæseligt
pjasket til med for-loops.
Er der nogen grund til at dette ikke skulle kunne
virke?

 
> > Har du husket at definere en copy funktion for
> matrixer?
> > Dvs. CMatrix CMatrix::operator=(CMatrix& A)?

Nej og det er med vilje, for jeg kan nok ikke optimere
den så godt som den der er default, og såfremt den
bare kopierer index for index, så gøres det korrekt.
Det er vist kun hvis der er pointere og andre
ubehagligheder i klassen man behøver skrive en
explicit.

 
> Som curriosum mener Bjarne Stroustrup at operatorer
> der ikke har
> sidevirkninger på en class bør erklæres som
> non-member functions.

Det behøver ikke være kønt, bare det virker;-)


Sune

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com


 
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] *