Re: How to find out if an int has no value
Richard <richardhengeve ld@hotmail.com> writes:
[color=blue]
> Nicolas Pavlidis <pavnic@sbox.tu graz.at> wrote in news:2r318iF13t vdiU2@uni-
> berlin.de:[/color]
[..]
[color=blue][color=green]
> > How can a point be empty? As said by Joona scalar Types always have
> > values, but you're responsible that they get initialized correctly.
> >
> > Or do you want to check if the point is (0,0)?
> >[/color]
> I want to make a fail save for myself. So, if I'd wrote
>
> Point p;
>
> somewhere without initializing it, I could check it whit my[/color]
Ok.
IMHO it is good style to write "constructorfun ctions", and geting
variables only over this functions. For example:
Point newPoint(int x, int y);
or better:
Point *newPoint(int x, int y);
So you can never get problems with uninitialized values, because you're
simulating a constructor.
With this way also unnecessary extraflags can be avoided.
Kind regards,
Nicolas
--
| Nicolas Pavlidis | Elvis Presly: |\ |__ |
| Student of SE & KM | "Into the goto" | \|__| |
| pavnic@sbox.tug raz.at | ICQ #320057056 | |
|-------------------University of Technology, Graz----------------|
Richard <richardhengeve ld@hotmail.com> writes:
[color=blue]
> Nicolas Pavlidis <pavnic@sbox.tu graz.at> wrote in news:2r318iF13t vdiU2@uni-
> berlin.de:[/color]
[..]
[color=blue][color=green]
> > How can a point be empty? As said by Joona scalar Types always have
> > values, but you're responsible that they get initialized correctly.
> >
> > Or do you want to check if the point is (0,0)?
> >[/color]
> I want to make a fail save for myself. So, if I'd wrote
>
> Point p;
>
> somewhere without initializing it, I could check it whit my[/color]
Ok.
IMHO it is good style to write "constructorfun ctions", and geting
variables only over this functions. For example:
Point newPoint(int x, int y);
or better:
Point *newPoint(int x, int y);
So you can never get problems with uninitialized values, because you're
simulating a constructor.
With this way also unnecessary extraflags can be avoided.
Kind regards,
Nicolas
--
| Nicolas Pavlidis | Elvis Presly: |\ |__ |
| Student of SE & KM | "Into the goto" | \|__| |
| pavnic@sbox.tug raz.at | ICQ #320057056 | |
|-------------------University of Technology, Graz----------------|
Comment