lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] Pass int by value when reference not needed [Was: rate_table_tool:


From: Greg Chicares
Subject: [lmi] Pass int by value when reference not needed [Was: rate_table_tool: merge a whole directory]
Date: Thu, 1 Dec 2016 22:46:49 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0

On 2016-11-30 15:08, Vadim Zeitlin wrote:
> On Wed, 30 Nov 2016 08:15:56 +0000 Greg Chicares <address@hidden> wrote:
[...]
> GC>   double table_impl::parse_single_value
> GC>     (char const* start
> GC>     ,char const*& current
> GC>     ,int& line_num
> GC>     )
[...]
> GC> Apparently the 'start' and 'line_num' arguments are used only for
> GC> writing diagnostics.
> 
>  Yes, exactly, as its comment says:
> 
>     // Helper of parse_values() parsing a single floating point value using 
> the
>     // exactly expected precision. Adjust the current pointer to advance past
>     // the value parsed, the other parameters are only used for diagnostics.
> 
> GC> If that's correct, BTW, then why is 'line_num' passed by reference?
> 
>  This seems like an oversight, both this function and parse_age() don't

and also skip_spaces()

> modify it (unlike some other parsing functions that can/do advance to the
> next line), so it should be passed by value. I don't know if it's worth
> making a trivial patch for this or if you prefer changing this yourself?

Changed. I'll push this commit in due course.




reply via email to

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