Who modified my local variable?
Jonathan Ellis
jonathan at carnageblender.com
Tue Jun 13 13:16:15 MDT 2006
On Tue, 13 Jun 2006 13:11:10 -0600, "Michael L Torrie"
<torriem at chem.byu.edu> said:
> On Tue, 2006-06-13 at 12:47 -0600, Bryan Sant wrote:
> > Local variable. Sometimes called an automatic variable in Java-terms.
> > Allocated on the heap (which is really just a stack in the case of
> > auto vars). Falls out of scope shortly. GC will pop this off the
> > heap-stack-thingy. No leaks.
>
> Sure. But my real point was the Java habit of always doing "new" causes
> a ton of problems for Java programmers heading into C++. Rather than
> use a local variable allocated on the stack, they do "new" which leaks.
> That is the problem. So really it's not a language problem; it's a
> programmer problem. But a programmer can be trained; unfortunately Java
> is not a good trainer in this instance. In my opinion it would be
> better to subject a new CS student to C and C++ in all their glory and
> then introduce them to managed, Garbage-collected languages later,
> rather than the other way around.
Well, it cuts the other way, too -- C++ is a poor trainer for more
modern languages. And it's pretty clear which group is on its way out.
-Jonathan
--
C++ is history repeated as tragedy. Java is history repeated as farce. --Scott McKay
More information about the PLUG
mailing list