www.digitalmars.com         C & C++   DMDScript  

D - auto Suggestion

reply "Phill" <phill pacific.net.au> writes:
Shouldn't  variables be "auto" automatically?

I was surprised to read that they werent.

Phill.



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004
Apr 02 2004
parent reply C <dont respond.com> writes:
I think the basic types are auto'ed , and structs are automatically auto=
, =

but classes require the keyword.  Its kinda hard coming from C++ to get =

over having to 'new' something thats on the stack , but it does drive ho=
me =

the point that everything must be new'ed :).

C

On Sat, 3 Apr 2004 07:55:59 +1000, Phill <phill pacific.net.au> wrote:

 Shouldn't  variables be "auto" automatically?

 I was surprised to read that they werent.

 Phill.



 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004
-- = D Newsgroup.
Apr 05 2004
next sibling parent J Anderson <REMOVEanderson badmama.com.au> writes:
C wrote:

 I think the basic types are auto'ed , and structs are automatically 
 auto, but classes require the keyword.  Its kinda hard coming from C++ 
 to get over having to 'new' something thats on the stack , but it does 
 drive home the point that everything must be new'ed :).

 C
I just remember that classes in D are actually pointers to objects, not objects themselves. Therefore classes need to be autoed if you want them handled by the stack. Everything else (for this particular topic) works the same as in C++. -- -Anderson: http://badmama.com.au/~anderson/
Apr 05 2004
prev sibling next sibling parent "Phill" <phill pacific.net.au> writes:
"C" <dont respond.com> wrote in message news:opr5z5iqrdehmtou localhost...
I think the basic types are auto'ed , and structs are automatically auto,
but classes require the keyword.  Its kinda hard coming from C++ to get
over having to 'new' something thats on the stack , but it does drive home
the point that everything must be new'ed :).

Especially women!

Phill

C

On Sat, 3 Apr 2004 07:55:59 +1000, Phill <phill pacific.net.au> wrote:

 Shouldn't  variables be "auto" automatically?

 I was surprised to read that they werent.

 Phill.



 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004
-- D Newsgroup. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.648 / Virus Database: 415 - Release Date: 3/31/2004
Apr 05 2004
prev sibling parent Achilleas Margaritis <Achilleas_member pathlink.com> writes:
In article <opr5z5iqrdehmtou localhost>, C says...
I think the basic types are auto'ed , and structs are automatically auto=
, =

but classes require the keyword.  Its kinda hard coming from C++ to get =

over having to 'new' something thats on the stack , but it does drive ho=
Auto objects are not on the stack. They are on the heap, but their destructor is called when when the pointer goes out of scope. It is there in order to implement RAII.
Apr 27 2004