auto storage class - infer or RAII?
Don Clugston
dac at nospam.com.au
Mon Nov 13 23:30:36 PST 2006
Kristian Kilpi wrote:
> 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)... ;)
It used to be the only way that worked. Early C compilers couldn't cope
with variables declared elsewhere. That restriction is long gone, now.
More information about the Digitalmars-d
mailing list