@@ -55,8 +55,8 @@ af_err af_create_array(af_array *result, const void * const data,
5555 const unsigned ndims, const dim_type * const dims,
5656 const af_dtype type)
5757{
58- af_array out;
5958 try {
59+ af_array out;
6060 AF_CHECK (af_init ());
6161 dim4 d ((size_t )dims[0 ]);
6262 for (unsigned i = 1 ; i < ndims; i++) {
@@ -86,8 +86,8 @@ af_err af_constant(af_array *result, const double value,
8686 const unsigned ndims, const dim_type * const dims,
8787 const af_dtype type)
8888{
89- af_array out;
9089 try {
90+ af_array out;
9191 AF_CHECK (af_init ());
9292 dim4 d ((size_t )dims[0 ]);
9393 for (unsigned i = 1 ; i < ndims; i++) {
@@ -123,8 +123,8 @@ static inline af_array createCplx(dim4 dims, const Ti real, const Ti imag)
123123af_err af_constant_complex (af_array *result, const double real, const double imag,
124124 const unsigned ndims, const dim_type * const dims, af_dtype type)
125125{
126- af_array out;
127126 try {
127+ af_array out;
128128 AF_CHECK (af_init ());
129129
130130 dim4 d ((size_t )dims[0 ]);
@@ -147,8 +147,8 @@ af_err af_constant_complex(af_array *result, const double real, const double ima
147147af_err af_constant_long (af_array *result, const intl val,
148148 const unsigned ndims, const dim_type * const dims)
149149{
150- af_array out;
151150 try {
151+ af_array out;
152152 AF_CHECK (af_init ());
153153
154154 dim4 d ((size_t )dims[0 ]);
@@ -167,8 +167,8 @@ af_err af_constant_long(af_array *result, const intl val,
167167af_err af_constant_ulong (af_array *result, const uintl val,
168168 const unsigned ndims, const dim_type * const dims)
169169{
170- af_array out;
171170 try {
171+ af_array out;
172172 AF_CHECK (af_init ());
173173
174174 dim4 d ((size_t )dims[0 ]);
@@ -188,8 +188,8 @@ af_err af_constant_ulong(af_array *result, const uintl val,
188188af_err af_create_handle (af_array *result, const unsigned ndims, const dim_type * const dims,
189189 const af_dtype type)
190190{
191- af_array out;
192191 try {
192+ af_array out;
193193 AF_CHECK (af_init ());
194194 dim4 d ((size_t )dims[0 ]);
195195 for (unsigned i = 1 ; i < ndims; i++) {
@@ -217,11 +217,11 @@ af_err af_create_handle(af_array *result, const unsigned ndims, const dim_type *
217217// Strong Exception Guarantee
218218af_err af_copy_array (af_array *out, const af_array in)
219219{
220- ArrayInfo info = getInfo (in);
221- const af_dtype type = info.getType ();
222-
223- af_array res;
224220 try {
221+ ArrayInfo info = getInfo (in);
222+ const af_dtype type = info.getType ();
223+
224+ af_array res;
225225 switch (type) {
226226 case f32 : res = copyArray<float >(in); break ;
227227 case c32: res = copyArray<cfloat >(in); break ;
@@ -261,8 +261,8 @@ static inline af_array identity_(const af::dim4 &dims)
261261
262262af_err af_randu (af_array *out, const unsigned ndims, const dim_type * const dims, const af_dtype type)
263263{
264- af_array result;
265264 try {
265+ af_array result;
266266 AF_CHECK (af_init ());
267267
268268 dim4 d ((size_t )dims[0 ]);
@@ -285,13 +285,13 @@ af_err af_randu(af_array *out, const unsigned ndims, const dim_type * const dims
285285 std::swap (*out, result);
286286 }
287287 CATCHALL
288- return AF_SUCCESS;
288+ return AF_SUCCESS;
289289}
290290
291291af_err af_randn (af_array *out, const unsigned ndims, const dim_type * const dims, const af_dtype type)
292292{
293- af_array result;
294293 try {
294+ af_array result;
295295 AF_CHECK (af_init ());
296296
297297 dim4 d ((size_t )dims[0 ]);
@@ -314,8 +314,8 @@ af_err af_randn(af_array *out, const unsigned ndims, const dim_type * const dims
314314
315315af_err af_identity (af_array *out, const unsigned ndims, const dim_type * const dims, const af_dtype type)
316316{
317- af_array result;
318317 try {
318+ af_array result;
319319 AF_CHECK (af_init ());
320320 dim4 d ((size_t )dims[0 ]);
321321
@@ -413,8 +413,8 @@ static inline af_array range_(const dim4& d, const int seq_dim)
413413af_err af_range (af_array *result, const unsigned ndims, const dim_type * const dims,
414414 const int seq_dim, const af_dtype type)
415415{
416- af_array out;
417416 try {
417+ af_array out;
418418 AF_CHECK (af_init ());
419419
420420 DIM_ASSERT (1 , ndims > 0 && ndims <= 4 );
@@ -448,8 +448,8 @@ static inline af_array iota_(const dim4 &dims, const dim4 &tile_dims)
448448af_err af_iota (af_array *result, const unsigned ndims, const dim_type * const dims,
449449 const unsigned t_ndims, const dim_type * const tdims, const af_dtype type)
450450{
451- af_array out;
452451 try {
452+ af_array out;
453453 AF_CHECK (af_init ());
454454
455455 DIM_ASSERT (1 , ndims > 0 && ndims <= 4 );
0 commit comments