c++ operator overloading

Kyriakos Oikonomakos kiriakos at obscurenet.com
Thu Feb 24 16:09:40 EET 2005


On Thu, 2005-02-24 at 16:01 +0200, Marios K. wrote:
> Ti la8os yparxei edo.
> 

[......]

> An allakso ton aaa[12] se aaa[2] 
> marios at base-06:~/Projects/test_c> ./a.out
> Start
> Segmentation fault
> 
> 
> Ti paizei?

oikka at flanders:~$ g++ mvector.cpp -o vec
oikka at flanders:~$ ./vec
Start
Segmentation fault
oikka at flanders:~$ g++ -Wall mvector.cpp -o vec
In file included from mvector.cpp:5:
mvector.h: In member function `int& MVECTOR::operator[](int)':
mvector.h:17: warning: no return statement in function returning
non-void
mvector.h:17: warning: control reaches end of non-void function
oikka at flanders:~$ vi mvector.h
oikka at flanders:~$ g++ -Wall mvector.cpp -o vec
oikka at flanders:~$ ./vec
Start
END
oikka at flanders:~$

(-Wall is your friend.)

An ftiakseis to provlhma pou prokalei ton compiler na petaksei warning 
to programma sou tha paiksei.

<flamebait>
(Kai kapou edw tha pesei to sxetiko flame/dick size war gia to poios
vazei ta pio polla/swsta/sexy/gyalistera flags otan kanei compile)
</flamebait>

-- 
Kyriakos Oikonomakos <kiriakos at obscurenet.com>




More information about the Linux-greek-users mailing list