auto storage class - infer or RAII?

Kristian Kilpi kjkilpi at gmail.com
Mon Nov 13 12:07:17 PST 2006


On Mon, 13 Nov 2006 21:17:32 +0200, Bill Baxter <wbaxter at gmail.com> wrote:

> Kristian Kilpi wrote:
>> On Mon, 13 Nov 2006 20:40:23 +0200, JC <johnch_atms at hotmail.com> wrote:
>
>>>> Also I don't like this syntax. All variables should always be  
>>>> declared  at
>>>> the begining of blocks.
>>>
>>>
>>> According to whom? That's a style thing, not a rule.
>>>
>>  Yes, that was just my humble opinion. :)
>>  I just think that it would be consistent if all the variables will be   
>> declared in the same place.
>
> You're free to have your opinion, but the C++ books I've read disagree  
> with you.    The ones I've read advocate declaring variables as close to  
> the point of usage as possible.  (Can't remember which books exactly,  
> but probably Stroustrup and/or Meyers' books.)
>
> --bb

Hehheh. Ok, I think I understant the point behind that. Well, I guess both  
the styles have their own advantages and disadvantages. The style where  
one declares (almost) all the variables at the begining of the (main)  
block works for me. Sorry for assuming that this style is the Correct  
Way(TM)... ;)



More information about the Digitalmars-d mailing list