edA-qa | 1 Oct 18:07

Re: Clarified references, shortcut notation

Slawomir Lisznianski wrote:
>   T static^ t0;
>   T^ t1 = null;
>   T^ t2;
> Above, t0 and t1 are bound to null. t2 reference is of indeterminate 
> initial value.

C++ is confused when it comes to default construction and 
initialization.  I have the opinion that unless stated otherwise, all 
objects should be default initialized and all references should be null 
initialized.  Meaning t2 about starts as null.

This makes sense since it is the *normal* case in programming.  For 
those people that need to make fine-tine optimizations you could 
introduce this syntax:

	T^ t2 = uninit;

Even with performance in mind it is rare that one would specifically 
want to leave a value unitialized (an optimizer will remove the 
redundant initialization should it not be needed).

--

-- 
edA-qa mort-ora-y
Idea Architect
http://disemia.com/

-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl

Gmane