octave-maintainers
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]