Bound checking in c/c++
Karaoulis Marios
marios at lemnos.geo.auth.gr
Thu Jun 17 09:11:58 EEST 2004
Deite auto
http://gcc.gnu.org/projects/bp/main.html
On Wednesday 16 June 2004 23:51, Stelios Bounanos wrote:
> >>>>> On Wed, 16 Jun 2004 19:07:59 +0300, Karaoulis Marios
> >>>>> <marios at lemnos.geo.auth.gr> was rumoured to have said:
> >
> > [1 <text/plain; us-ascii (7bit)>]
> > Exo auto to programma
> > #include <stdio.h>
> > #include <stdlib.h>
> > int main()
> > {
> > float a[5];
> > int i;
> > a[0]=0;
> > a[1]=1;
> > a[2]=2;
> > a[3]=3;
> > a[4]=4;
> > a[15]=5;
> > for (i=0;i<=4;i++) printf("%f\n",a[i]);
> > printf("%f\n",a[15]);
> > return 0;
> > }
> >
> > to kano compile os
> > gcc -fbound-checking foo.c
> >
> > Alla den gurnaei kapio warning
> > otan to trexo gyrnaei apotelesma gia to a[15]
> > Ti ginetai?
> > Den pianei to flag?
>
> Diabazontas to manual page toy gcc, 8a deis oti to -fbounds-check (opws
> legetai ston gcc-3.3.4) ypothrizetai mono gia Java kai Fortran77.
>
> Enallaktikes lyseis einai na trekseis to programma soy me kapoio apo toys
> polloys memory debuggers/profilers 'h, sth C++, na xrhsimopoihseis ena STL
> vector me checked access (p.x. v.at(i) anti gia v[i]).
>
>
> rgds,
> /-sb.
More information about the Linux-greek-users
mailing list