[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Replace OCTAVE_LOCAL_BUFFER implementation with std::unique_ptr?
From: |
Mike Miller |
Subject: |
Re: Replace OCTAVE_LOCAL_BUFFER implementation with std::unique_ptr? |
Date: |
Fri, 21 Jul 2017 10:15:45 -0700 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
On Fri, Jul 21, 2017 at 12:54:14 -0400, John W. Eaton wrote:
> I admit to having to read about the meaning of this type of statement that
> appears in your patch:
>
> int arg_used[7] {};
>
> and I'm still a bit confused. Is there any difference between this syntax
> and
>
> int arg_used[7] = {};
>
> ? They both initialize the elements of the array to 0, correct?
>
> Should we have a preferred style for this?
Both are equivalent when the object being initialized is an array.
But the
Matrix a {};
syntax also applies when the object being initialized is a class type or
a non-class type.
Personally I try to use the brace form without equals sign for both
arrays and class types now.
I refer to this page a lot
http://en.cppreference.com/w/cpp/language/initialization
--
mike
- Replace OCTAVE_LOCAL_BUFFER implementation with std::unique_ptr?, Rik, 2017/07/18
- Re: Replace OCTAVE_LOCAL_BUFFER implementation with std::unique_ptr?, John W. Eaton, 2017/07/18
- Re: Replace OCTAVE_LOCAL_BUFFER implementation with std::unique_ptr?, Rik, 2017/07/19
- Re: Replace OCTAVE_LOCAL_BUFFER implementation with std::unique_ptr?, John W. Eaton, 2017/07/19
- Re: Replace OCTAVE_LOCAL_BUFFER implementation with std::unique_ptr?, Rik, 2017/07/20
- Re: Replace OCTAVE_LOCAL_BUFFER implementation with std::unique_ptr?, John W. Eaton, 2017/07/20
- Re: Replace OCTAVE_LOCAL_BUFFER implementation with std::unique_ptr?, Rik, 2017/07/21
- Message not available
- Message not available
- Message not available
- Re: Replace OCTAVE_LOCAL_BUFFER implementation with std::unique_ptr?, Daniel J Sebald, 2017/07/21
- Re: Replace OCTAVE_LOCAL_BUFFER implementation with std::unique_ptr?, Daniel J Sebald, 2017/07/23
- Re: Replace OCTAVE_LOCAL_BUFFER implementation with std::unique_ptr?, John W. Eaton, 2017/07/21
- Re: Replace OCTAVE_LOCAL_BUFFER implementation with std::unique_ptr?,
Mike Miller <=
- Re: initialization style, Rik, 2017/07/21