Skip to content

Conversation

@mbeutel
Copy link
Contributor

@mbeutel mbeutel commented May 19, 2025

This PR bumps the gsl-lite dependency version to v1.0.

gsl-lite v1.0 has some breaking changes (cf. our v1.0.0 release notes), which necessitate some changes here.

The most obvious changes are the name of the header file (now <gsl-lite/gsl-lite.hpp>) and the namespace (now gsl_lite; I added a gsl alias to namespace telnetpp).

By default, span<> does not define comparison operators anymore, which means that we need to compare spans through other means. I added a bytes_equal() function object to explicitly compare two byte spans and adapted the code where necessary. A less invasive fix would be to re-enable span comparison operators by defining gsl_CONFIG_ALLOWS_SPAN_COMPARISON=1. However, comparison operators are no longer provided by default for good reason (unclear semantics), and C++20 std::span<> doesn't have them either, so this appears to be the most forward-looking way to handle it.

Some minor adjustments were needed because span<>::iterator is now a custom iterator class rather than a plain pointer type.


This change is Reviewable

mbeutel added 6 commits May 19, 2025 16:48
The least invasive fix would be to re-enable span comparison operators by defining `gsl_CONFIG_ALLOWS_SPAN_COMPARISON=1`. However, comparison operators are no longer provided by default for good reason (unclear semantics), and C++20 `std::span<>` doesn't have comparison operators either, so this appears to be the most forward-looking way to handle it.
The gsl-lite build script is well-behaved an d does not build tests by default.
@mbeutel
Copy link
Contributor Author

mbeutel commented May 19, 2025

The Appveyor tests fail because they retrieve their dependencies with Vcpkg, which doesn't have gsl-lite v1.0 yet. I submitted a PR to upgrade gsl-lite to v1.0.0, only to find that this breaks Telnet++. A Catch-22 situation :)

@KazDragon
Copy link
Owner

@mbeutel This is great, thanks for the contrib. I'm actually in the (slow) process of removing gsl-lite from my libraries because C++20 obsoletes the parts that I use, but this is very fine for the situation that it's in and if it fixes integration with vcpkg, then all for the better. Much appreciated.

@KazDragon KazDragon merged commit dec6d24 into KazDragon:master May 23, 2025
6 of 10 checks passed
@mbeutel
Copy link
Contributor Author

mbeutel commented May 23, 2025

Excellent, thank you for the quick response!

The GSL was already a stop-gap when the Core Guidelines were introduced 10 years ago; it really shouldn't need to exist anymore. C++20 added spans (albeit unchecked ones), and C++26 will finally add contracts, so more and more of the GSL will become obsolete. I think gsl-lite can be considered "done" at this point; I just wanted to finally resolve the interference issue with Microsoft GSL, which in turn required the breaking change.

@KazDragon
Copy link
Owner

In any case, your contributions have been a great help, so thank you.

@mbeutel
Copy link
Contributor Author

mbeutel commented May 28, 2025

Thanks for preparing the new release so quickly. Telnet++ 4.0.0 is now available via Vcpkg.

@KazDragon
Copy link
Owner

Awesome!

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

Successfully merging this pull request may close these issues.

2 participants