mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cong Wang" <cw...@twopensource.com>
Subject Re: Review Request 40953: Avoid accepting hex float literals
Date Fri, 04 Dec 2015 23:22:28 GMT


> On Dec. 4, 2015, 11:13 p.m., Benjamin Bannier wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/numify.hpp, line 37
> > <https://reviews.apache.org/r/40953/diff/1/?file=1153565#file1153565line37>
> >
> >     Just noticed that this fails to parse negative hex numbers like `-0x2`. This
seems overly restrictive to me.

If you have any use case for that, sure, please do make it better. But I don't have any.


> On Dec. 4, 2015, 11:13 p.m., Benjamin Bannier wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/numify.hpp, line 38
> > <https://reviews.apache.org/r/40953/diff/1/?file=1153565#file1153565line38>
> >
> >     Instead of this comment we should specify what *we* support (we are not writing
a C++ lexer, but interpreting user input here).
> >     
> >     My expectation for this would be to support what e.g., a `stringstream` can
parse with `hex` or `hexfloat` (or `stoi`, `strtof`, ...).

Yeah we can add doc for this function. Or even better: fix boost::lexical_cast.


> On Dec. 4, 2015, 11:13 p.m., Benjamin Bannier wrote:
> > 3rdparty/libprocess/3rdparty/stout/tests/numify_tests.cpp, line 42
> > <https://reviews.apache.org/r/40953/diff/1/?file=1153566#file1153566line42>
> >
> >     As currently implemented we should test that mixed float & exponent forms
also fail, e.g. `0xF.Ep-1`.
> >     
> >     I do not agree that being so limited is needed.
> >     
> >     Note that e.g., `strtof` would fail to parse `0x10.9` since it lacks the required
exponent.

Ditto, if you need that case, please go for it.


- Cong


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/40953/#review109018
-----------------------------------------------------------


On Dec. 4, 2015, 5:23 a.m., Cong Wang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/40953/
> -----------------------------------------------------------
> 
> (Updated Dec. 4, 2015, 5:23 a.m.)
> 
> 
> Review request for mesos, Benjamin Bannier, Ben Mahler, Jie Yu, and Michael Park.
> 
> 
> Bugs: MESOS-4045
>     https://issues.apache.org/jira/browse/MESOS-4045
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> GCC, as an extension, accepts hex float literals even for C++, this is not allowed by
standard C++. So we disallow it explicitly.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/numify.hpp 2035653d578497e88ef465dc6cd49e2c0fc53366

>   3rdparty/libprocess/3rdparty/stout/tests/numify_tests.cpp 26fa7a4a06b36f9e7490e3274264f84b0369d412

> 
> Diff: https://reviews.apache.org/r/40953/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Cong Wang
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message