[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Archetype for C++ function
From: |
Olaf Till |
Subject: |
Re: Archetype for C++ function |
Date: |
Mon, 7 Dec 2015 16:34:37 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Mon, Dec 07, 2015 at 08:55:12AM -0500, John W. Eaton wrote:
> On 12/06/2015 11:07 PM, Rik wrote:
> ...
> >In browsing through the code I see there has been some confusion as to what
> >data type to use for nargin. The two most common templates are
> >
> >--- nargin templates ---
> >int nargin = args.length ();
> >octave_idx_type nargin = args.length ();
> >--- End Code ---
> >
> >I propose standardizing on the first since it is shorter.
>
> Using int should be OK as I don't think it is reasonable for it to ever be
> larger than 2^31. At least I hope no one ever needs that. Can you imagine
> a case where that could be true?
Maybe something like the following:
horzcat (large_cell_array{:})
Indeed a similar line is currently in scripts/general/cell2mat.m. And
if someone wants to handle matrices so large that octave_idx_type is
needed, it is probably equally legitimate to handle cell-arrays
(containing numbers) of that size.
But why not deciding for each function separately if octave_idx_type
could be needed ...
Olaf
--
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net
signature.asc
Description: Digital signature