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

Add warnings about numeric strings in scientific notation #4407

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jimwins
Copy link
Member

@jimwins jimwins commented Jan 19, 2025

Comment on lines +88 to +103
<warning>
<simpara>
When using the <link linkend="language.operators.comparison">comparison
operator (<literal>==</literal>)</link>,
<link linkend="language.types.numeric-strings">numeric strings</link>
will be compared as numbers instead of as strings.
This means that <literal>"123" == " 123 "</literal> is &true;,
but also that <literal>"0e1234" == "0e5678"</literal> is &true;,
which can cause unexpected behavior when comparing hexidecimal strings
like those from <function>hash</function>.
The identity operator (<literal>===</literal>) or a string comparison
function, such as <function>strcmp</function> or
<function>hash_compare</function>, should be used to avoid unexpected
results.
</simpara>
</warning>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in the comparative type juggling section, not the string one.

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