<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_UNCONFIRMED "
title="UNCONFIRMED - Long hexadecimal values are wrongly interpreted as Integers when they start with zeroes"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=142048">142048</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Long hexadecimal values are wrongly interpreted as Integers when they start with zeroes
</td>
</tr>
<tr>
<th>Product</th>
<td>LibreOffice
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>UNCONFIRMED
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>BASIC
</td>
</tr>
<tr>
<th>Assignee</th>
<td>libreoffice-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jean-francois.nifenecker@laposte.net
</td>
</tr></table>
<p>
<div>
<pre>In Basic, when a numerical value is declared as hexadecimal (ex: MyVar =
&H00008000), the starting zeroes are ignored. Thus the resulting number is
wrongly interpreted (value and type). This also applies to constants declares.
This breaks code. I was mostly programming under v.5.4 without glitches. Since
I upgraded to 7.0.5, the problem has arisen. This problem seems related to bug
#62326 fix (applicable to 6.4).
The code below shows the problem:
Sub TestHex()
Dim MyInt As Integer
Dim MyLong As Long
Dim MyVariant As Variant
'type 2 = integer ; 3 = long
'Rule: when the most significant bit is 1, should return a negative
value (see <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - Instruction Cint fails when converting Hex strings of a negative value to a 16-bit integer value."
href="show_bug.cgi?id=62326">bug #62326</a>).
'see: <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - Instruction Cint fails when converting Hex strings of a negative value to a 16-bit integer value."
href="show_bug.cgi?id=62326">https://bugs.documentfoundation.org/show_bug.cgi?id=62326</a>
'should be: -32768, 2
MyInt = &H8000
MsgBox MyInt & Chr(10) & VarType(MyInt) 'OK. returns: -32768, 2
'should be: 32768, 3
MyLong = &H00008000
MsgBox MyLong & Chr(10) & VarType(MyLong) 'NOK. returns: -32768,
3
'should be: 32768, 3
MyVariant = &H00008000
MsgBox MyVariant & Chr(10) & VarType(MyVariant) 'NOK. returns:
-32768, 2
End Sub
I consider this to be a major or critical bug because it actually breaks code.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>