Diafores metaksy gcc 3.4 kai 3.3
Karaoulis Marios
marios at lemnos.geo.auth.gr
Sat Nov 20 16:01:55 EET 2004
On Sat, 2004-11-20 at 15:53, Giorgos Keramidas wrote:
> On 2004-11-20 10:54, Karaoulis Marios <marios at lemnos.geo.auth.gr> wrote:
> > Eimai enas mallon metrios pros kakos programmatisths. Xrhsimopoio thn
> > c++ gia kapoious algori8mopus pou grafo. Exo tsatistei me olh auth thn
> > katastash pou epikratei sthn c++.
>
> Hremia. Apla kapoio lathos kaneis :-P
>
> > H logikh einai h ekshs
> >
> > #include <memorh.h>
> > #include <iostream>
> > #include <new>
> > #include <excpeption>
> > #include "marutil.h"
>
> Mhpws to excpeption prepei na einai 'exception'?
>
> > int main()
> > {
> > //pinaka a 20 x 10 diadtasewn. Perna kai to onoma tou pinaka gia naksero
> > //an kapoios pinakas xtyphsei na ksero pou
> >
> > float **a=float_matrix(20,10,a);
> > }
>
> Bad idea!
>
> Pernas thn timh pou exei kapoia stigmh, prin to function call, o pointer `a'.
> Amesos meta to float_matrix() call teleiosei, h timh ayth einai praktika
> invalid -- toulaxiston oson afora oti eixes kata nou otan thn apo8hkeyes
> eswterika sthn float_matrix.
>
> Estw oti prin to assignment:
>
> float **a = float_matrix(20, 10, a);
>
> to pointer `a' eixe timh 0 (kai kala NULL pointer, epeidh den to exeis
> arxikopoihsei akoma). Ayth einai h timh pou tha parei h float_matrix.
> Malista ayth h timh tha einai entelos axrhsth epeidh thn pernas mesw enos
> char[] transformation tou pointer, pou den exei mallon kamia apolutws aksia
> pleon -- exei xasei thn plhroforia oti einai float vector.
>
Χίλια συγνώμη, το σωστό είναι αυτό
#include <memorh.h>
#include <iostream>
#include <new>
#include <exception>
#include "marutil.h"
int main()
{
//pinaka a 20 x 10 diadtasewn. Perna kai to onoma tou pinaka gia naksero
//an kapoios pinakas xtyphsei na ksero pou
float **a=float_matrix(20,10,"a");
}
More information about the Linux-greek-users
mailing list