RE: Reaching the limits of 'learn by example'
RE: Reaching the limits of 'learn by example'
- Subject: RE: Reaching the limits of 'learn by example'
- From: Jens Baumeister <email@hidden>
- Date: Mon, 14 May 2001 18:14:57 +0200
>
-----Original Message-----
>
From: Stefan Arentz [mailto:email@hidden]
>
On Sun, May 13, 2001 at 11:51:58PM +0200, Cyril Godefroy wrote:
>
> PS:
>
> Brian Hill just told me I can't do what I did while I was
>
writing those
>
> lines. How come I can't? (And yes, I usually use a so-called object
>
> oriented language where I usually can do that kind of stuff).
>
>
That's just a (silly) C rule. Every language has it's own
>
rules, and even
>
though some languages look alike (i guess you talk about
>
java), there are
>
details that are different.
More specifically, this C rule states that local variables must be declared
at the beginning of a block. Coming from Java as well, it took me a while to
figure out that I didn't have to delare all my stuff at the beginning of the
method - any block surrounded by { and } will do. Note that the variables'
scope is only inside the block it's declared in, of course.
_____________________________________
Jens Baumeister
Bullex GmbH, Cologne, Germany
She sells c-shells by the sea shore.