fastfloat / fast_float

Fast and exact implementation of the C++ from_chars functions for number types: 4x to 10x faster than strtod, part of GCC 12, Chromium and WebKit/Safari
Apache License 2.0
1.35k stars 124 forks source link

`ascii_number.h` is closing `namespace` incorrectly #240

Closed Ahmad-S792 closed 6 months ago

Ahmad-S792 commented 6 months ago

Hi,

Was looking into ascii_number.h file from WebKit source and noticed that closing } for namespace was missing.

WebKit Source: https://github.com/WebKit/WebKit/blob/5c17946e30a84685b0c48e0657f5b3f12b9afd17/Source/WTF/wtf/fast_float/ascii_number.h#L20

So I looked into source file from this repo and it is missing two } unlike WebKit source.

So just wanted to raise this issue. :-)

Thanks!

Ahmad-S792 commented 6 months ago

Just to add when I add missing (I am using VSCode builtin function to highlight closing functions, so it might be 'VSCode' issue), I get following error:


      extraneous closing brace ('}')
} // namespace fast_float
^
lemire commented 6 months ago

I am going to close this. If you think that there is an unclosed namespace, I invite you to issue a pull request or to provide an analysis. As things stand, I only have a claim that there is faulty unclosed bracket... I need more evidence that there is a problem.

Note that this library is in widespread use.

jwakely commented 6 months ago

The plugin is just confused by this code:

https://github.com/fastfloat/fast_float/blob/ff7cb4426320d8297b2e9e01d8fd2723d7368469/include/fast_float/ascii_number.h#L283-L287

There are two opening braces there, but only one needs to be closed. If your editor doesn't understand the C++ preprocessor groups, it will think they both need to be closed.

Ahmad-S792 commented 6 months ago

The plugin is just confused by this code:

https://github.com/fastfloat/fast_float/blob/ff7cb4426320d8297b2e9e01d8fd2723d7368469/include/fast_float/ascii_number.h#L283-L287

There are two opening braces there, but only one needs to be closed. If your editor doesn't understand the C++ preprocessor groups, it will think they both need to be closed.

Most likely this is the case, I do have C++ extensions. Will try to find culprit. :-)