Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux: compiler errors for ToLongEx(), ToDoubleEx() implementation #351

Open
GWRon opened this issue Dec 22, 2024 · 1 comment
Open

Linux: compiler errors for ToLongEx(), ToDoubleEx() implementation #351

GWRon opened this issue Dec 22, 2024 · 1 comment

Comments

@GWRon
Copy link
Contributor

GWRon commented Dec 22, 2024

[ 42%] Compiling:blitz_string_ex.cpp
/build/temp/BlitzMax/mod/brl.mod/blitz.mod/blitz_string_ex.cpp: In function 'int bbStringToDoubleEx(BBString*, double*, int, int, BBULONG, BBString*)':
/build/temp/BlitzMax/mod/brl.mod/blitz.mod/blitz_string_ex.cpp:48:14: error: expected unqualified-id before '[' token
         auto [ptr, ec] = fast_float::from_chars_advanced(p, e, result, options);
              ^
/build/temp/BlitzMax/mod/brl.mod/blitz.mod/blitz_string_ex.cpp:49:13: error: 'ptr' was not declared in this scope
         if (ptr != nullptr) {
             ^

Further detailes in the log of the failed github-action for the weekly build:
https://github.com/bmx-ng/bmx-ng/actions/runs/12450294810/job/34756965551

@GWRon
Copy link
Contributor Author

GWRon commented Dec 22, 2024

According to
https://gcc.gnu.org/projects/cxx-status.html

Structured bindings are available from GCC 7 on:
Structured bindings [P0217R3]
(https://wg21.link/p0217) 7 __cpp_structured_bindings >= 201606

The build environment of Ubuntu 16 provides GCC 5.4.0

Structured bindings could possibly be avoided there by doing it this way:
current:

    if ( sepChar != 0 && sepChar != '.' ) {
        fast_float::parse_options_t<char16_t> options{static_cast<fast_float::chars_format>(format), sepChar};
        auto [ptr, ec] = fast_float::from_chars_advanced(p, e, result, options);
        if (ptr != nullptr) {
            *val = result;
            return ptr - start;
        }
    }

new:

    if ( sepChar != 0 && sepChar != '.' ) {
        fast_float::parse_options_t<char16_t> options{static_cast<fast_float::chars_format>(format), sepChar};
        auto result_pair = fast_float::from_chars_advanced(p, e, result, options);
        auto ptr = result_pair.first;
        auto ec = result_pair.second;
        if (ptr != nullptr) {
            *val = result;
            return ptr - start;
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant