Re: error: unable to find numeric literal operator ‘operator"" f’

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

 



On 13 February 2014 03:13, Henrik Mannerström wrote:
> In his blog, Herb Sutter says it's "Modern C++ style" to use "auto x =
> 42f;".  When compiling the program below with gcc 4.8.1, I get an error.
>
> int main() {
>   auto a = 42f;
>   return a;
> }
>
> $ g++ -std=gnu++1y -Wall -Wextra -pedantic test.cc
> test.cc: In function ‘int main()’:
> test.cc:2:12: error: unable to find numeric literal operator ‘operator"" f’
>    auto a = 42f;
>
> Am I missing something?
> BR,
> Henrik Mannerström
>
> http://herbsutter.com/2013/08/12/gotw-94-solution-aaa-style-almost-always-auto/

Herb's example is wrong, the floating suffix f is only valid on a
floating-literal, which must have a . character, so it should be

auto a = 42.f





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux