-
-
Notifications
You must be signed in to change notification settings - Fork 232
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
Too long numeric hex literal silently converted to value 0 with an alias #7594
Comments
NOTE: This seems to be a generic parser issue: for example For comparison, for
|
I.e. it's definitely bug, not a feature? |
The |
OK, will take a look at it |
I fully disagree with you here. It's so valid as is the expression The lexer consumes characters as the current token accepts them and stops when not. For the record, |
In the expression
Following those rules, things like
Then Oracle does it wrong too. |
Ok, but then choose to follow the standard for no good reason and break applications. I see no need for that. The main issue could and should be fixed and actually this part has nothing to do with it. |
I'm not sure what you mean with this. The rule I quote is a sane rule for a parser/tokenizer, and I suspect no one in their right mind would write something like
I disagree. The rule I quote has everything to do with it: if the rule would be followed then even the current tokenization (which for |
I already received the same question by people, "why this works"? So, people write it. For me it's nonsense like things |
If you wanted to write an arithmetical nonsense you should use |
23.05.2023 13:40, Adriano dos Santos Fernandes wrote:
> I already received the same question by people, "why this works"? So,
> people write it.
But the question itself means they also consider this abnormal and thus
likely to agree with this to be fixed.
People used longer-than-31-character aliases for years, but we broke it
(for a reason). Making the lexer rules more consistent may be a good
reason too. Just my 2 cents.
> For me it's nonsense like things |1+2+3| without spaces, and yes, people
> write it (a lot).
This is not a nonsense for me, although I never write expressions this
way myself. For me it's just a readability thing like "if(expr) -> if
(expr)". But something like if(expr)then1else0 would surely be nonsense.
Dmitry
|
You're proving my point that they would expect it to produce an error.
And following the rule I quoted that will continue to work, because |
On 5/23/23 13:52, Dmitry Yemanov wrote:
But something like if(expr)then1else0 would surely be nonsense.
Yes, and for me treating 0alias as 2 separate tokens appears to be
nonsense too.
The 2 known to me possible excuses for keeping it in parser are:
- matches standard (thks to Mark, we know it does not match)
- is actively used by people.
Adriano, when you say that people asked you about it - may be they
mistyped and were surprised that it works?
|
I don't know. It may be someone reading an existing working code and surprised by it. My point is that as it also works in Oracle, it's not so uncommon. It's not standard compliant, but if we are going to change every piece that not follows the standard, our users will be in problem. |
If a numeric hex literal is too long (more than 32 hex digits in Firebird 4.0 and 5.0, more than 16 hex digits in Firebird 3.0), it is silently converted to the value
0
with an alias equal to the remainder of the literal.For example
(first column is a valid INT128 literal in Firebird 4.0 and higher with 32 digits, while the second is invalid, with 33 digits)
This should raise an error instead.
The text was updated successfully, but these errors were encountered: