Discussion:
[Bug-apl] Assertion failed
Elias Mårtenson
2017-08-08 07:28:43 UTC
Permalink
Sorry for not replying earlier, I forgot about this message.

ucs[0] should be OK for an empty string, as that will still refer to the
terminating NUL byte at the end of the string. Note that an empty string is
differetn from a NULL pointer (the former is a valid string, and the other
is not).

Regards,
Elias
Hi Elias,
*/// return a UTF8 encoded std:string*
*inline std::string to_string(const UCS_string & ucs)*
*{*
* const UTF8_string utf(ucs);*
* return string((const char *)&utf[0], utf.size());*
*}*
I am not sure what happens if string *ucs* is empty (in that case *ucs[0]
*does not
exist and may be makes *&**ucs[0]* also 0. The std::string constructor
then looks
for the terminating 0 character in a 0-pointer. Using *UTF8:string::c_str*
*()* might
be better.
Also converting a UCS or UTF8 string to *std::string* just for outputting
it with << may be
an overkill, since *ostream << *often (read: after *#include
"PrintOperator.hh*") understands
UCF and UCS strings directly.
/// JÃŒrgen
Can you tell me exactly what you are doing in order to reproduce the
problem?
Regards,
Elias
Juergen Sauermann
2017-08-08 10:11:57 UTC
Permalink
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font face="Helvetica, Arial, sans-serif">Hi Elias,<br>
<br>
correct, except that an <b>UCS8_string</b> is not a string,
despite of its name.<br>
</font><font face="Helvetica, Arial, sans-serif"><b>UCS8_string</b>s
have no terminating 0 byte; the 0-byte is only appended if<br>
</font><font face="Helvetica, Arial, sans-serif"><font
face="Helvetica, Arial, sans-serif">the <b>UCS8_string</b> is
converted to a C string with function <b>c_str()</b>.<br>
<br>
/// Jürgen<br>
<br>
<br>
</font></font>
<div class="moz-cite-prefix">On 08/08/2017 09:28 AM, Elias Mårtenson
wrote:<br>
</div>
<blockquote
cite="mid:CADtN0W+-chxp0w90cWwXB0o+av6cvn1ZWd5yx=***@mail.gmail.com"
type="cite">
<div dir="ltr">Sorry for not replying earlier, I forgot about this
message.
<div><br>
</div>
<div>ucs[0] should be OK for an empty string, as that will still
refer to the terminating NUL byte at the end of the string.
Note that an empty string is differetn from a NULL pointer
(the former is a valid string, and the other is not).</div>
<div><br>
</div>
<div>Regards,</div>
<div>Elias</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 1 August 2017 at 19:04, Juergen
Sauermann <span dir="ltr">&lt;<a moz-do-not-send="true"
href="mailto:***@t-online.de"
target="_blank">***@t-online.de</a>&gt;</span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> <font
face="Helvetica, Arial, sans-serif">Hi Elias,<br>
<br>
I don't know what Ala'a did. However, looking at:<br>
<br>
<font face="Courier New, Courier, monospace"><b>///
return a UTF8 encoded std:string</b><b><br>
</b><b>inline std::string to_string(const UCS_string
&amp; ucs)</b><b><br>
</b><b>{</b><b><br>
</b><b>    const UTF8_string utf(ucs);</b><b><br>
</b><b>    return string((const char *)&amp;utf[0],
utf.size());</b><b><br>
</b><b>}</b></font><br>
<br>
I am not sure what happens if string <b>ucs</b> is
empty (in that case <b>ucs[0] </b>does not <br>
exist and may be makes <b>&amp;</b></font><font
face="Helvetica, Arial, sans-serif"><font
face="Helvetica, Arial, sans-serif"><b>ucs[0]</b> also
0. The std::string constructor then looks<br>
for the terminating 0 character in a 0-pointer. Using
<b>UTF8:string::c_str</b></font><b>()</b> might<br>
be better.<br>
<br>
Also converting a UCS or UTF8 string to <b>std::string</b>
just for outputting it with &lt;&lt; may be<br>
an overkill, since <b>ostream &lt;&lt; </b>often
(read: after <b>#include "PrintOperator.hh</b>")
understands<br>
UCF and UCS strings directly.<br>
<br>
/// Jürgen<br>
<br>
</font><span class=""><br>
<div class="m_7731621557996309202moz-cite-prefix">On
07/31/2017 02:31 AM, Elias Mårtenson wrote:<br>
</div>
<blockquote type="cite">
<div dir="auto">Can you tell me exactly what you are
doing in order to reproduce the problem? 
<div dir="auto"><br>
</div>
<div dir="auto">Regards, </div>
<div dir="auto">Elias </div>
</div>
<div class="gmail_extra"><br>
</div>
</blockquote>
<br>
</span></div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>
Elias Mårtenson
2017-08-08 10:18:14 UTC
Permalink
If that's the case, then you are indeed right. It's possible that the
std::string constructor will work, but that would be more out of luck than
anything else.

Regards,
Elias
Hi Elias,
correct, except that an *UCS8_string* is not a string, despite of its
name.
*UCS8_string*s have no terminating 0 byte; the 0-byte is only appended if
the *UCS8_string* is converted to a C string with function *c_str()*.
/// JÃŒrgen
Sorry for not replying earlier, I forgot about this message.
ucs[0] should be OK for an empty string, as that will still refer to the
terminating NUL byte at the end of the string. Note that an empty string is
differetn from a NULL pointer (the former is a valid string, and the other
is not).
Regards,
Elias
On 1 August 2017 at 19:04, Juergen Sauermann <
Hi Elias,
*/// return a UTF8 encoded std:string*
*inline std::string to_string(const UCS_string & ucs)*
*{*
* const UTF8_string utf(ucs);*
* return string((const char *)&utf[0], utf.size());*
*}*
I am not sure what happens if string *ucs* is empty (in that case *ucs[0]
*does not
exist and may be makes *&**ucs[0]* also 0. The std::string constructor
then looks
for the terminating 0 character in a 0-pointer. Using
*UTF8:string::c_str**()* might
be better.
Also converting a UCS or UTF8 string to *std::string* just for
outputting it with << may be
an overkill, since *ostream << *often (read: after *#include
"PrintOperator.hh*") understands
UCF and UCS strings directly.
/// JÃŒrgen
Can you tell me exactly what you are doing in order to reproduce the
problem?
Regards,
Elias
Ala'a Mohammad
2017-08-28 18:10:38 UTC
Permalink
Hi,

I do not know if this is the same cause, but the assertion seems to be the same

in a new session do the following
- write an incorrect name like 'x.y'
- edit a function like 'z'
- save the function
- edit the z function again, and you get the failed assertion

I'm running the latest APL version from svn:
: apl --version
BUILDTAG:
---------
Project: GNU APL
Version / SVN: 1.7 / 1003M
Build Date: 2017-08-28 18:02:08 UTC
Build OS: Linux 3.13.0-37-generic x86_64
config.status: 'RATIONAL_NUMBERS_WANTED=yes'
Archive SVN: 989

Here is a session sample:
----------------------------------

x.y
VALUE ERROR
x.y
^
∇z
∇z

==============================================================================
Assertion failed: items
in Function: at
in file: ../Simple_string.hh:277

Call stack:

----------------------------------------
-- Stack trace at ../Simple_string.hh:277
----------------------------------------
0x7F2ECE271184
0x7F2EC8FF0BDE connection_loop(void*)
0x7F2EC8FF40FE NetworkConnection::run()
0x7F2EC8FF30CB NetworkConnection::process_command(std::string const&)
0x7F2EC8FECCA7 FnCommand::run_command(NetworkConnection&,
std::vector<std::string, std::allocator<std::string> > const&)
0x45EA0F do_Assert(char const*, char const*, char const*, int)
========================================

SI stack:

Depth: 0
Exec: 0xbaf770
Safe exec: 0
Pmode: ◊ x.y
PC: 0 (5) 'y
Stat: x.y
err_code: 0x30001
thrown at: Symbol.cc:683
e_msg_1: 'VALUE ERROR'
e_msg_2: ' x.y'
e_msg_3: ' ^'


==============================================================================
terminate called after throwing an instance of 'ErrorCode'

Process apl aborted


Hope It Helps

Regards,

Ala'a
Post by Elias MÃ¥rtenson
If that's the case, then you are indeed right. It's possible that the
std::string constructor will work, but that would be more out of luck than
anything else.
Regards,
Elias
Hi Elias,
correct, except that an UCS8_string is not a string, despite of its name.
UCS8_strings have no terminating 0 byte; the 0-byte is only appended if
the UCS8_string is converted to a C string with function c_str().
/// Jürgen
Sorry for not replying earlier, I forgot about this message.
ucs[0] should be OK for an empty string, as that will still refer to the
terminating NUL byte at the end of the string. Note that an empty string is
differetn from a NULL pointer (the former is a valid string, and the other
is not).
Regards,
Elias
On 1 August 2017 at 19:04, Juergen Sauermann
Hi Elias,
/// return a UTF8 encoded std:string
inline std::string to_string(const UCS_string & ucs)
{
const UTF8_string utf(ucs);
return string((const char *)&utf[0], utf.size());
}
I am not sure what happens if string ucs is empty (in that case ucs[0]
does not
exist and may be makes &ucs[0] also 0. The std::string constructor then
looks
for the terminating 0 character in a 0-pointer. Using
UTF8:string::c_str() might
be better.
Also converting a UCS or UTF8 string to std::string just for outputting
it with << may be
an overkill, since ostream << often (read: after #include
"PrintOperator.hh") understands
UCF and UCS strings directly.
/// Jürgen
Can you tell me exactly what you are doing in order to reproduce the
problem?
Regards,
Elias
Ala'a Mohammad
2017-08-28 19:45:16 UTC
Permalink
Hi,

Trying to reduce the steps above to 'define, save, define' gives the
same thing above. This only happens when the defined function is saved
without a body (saved only with the header).

Network listener started. Connection information: mode:tcp addr:35039
∇x
∇x

==============================================================================
Assertion failed: items
in Function: at
in file: ../Simple_string.hh:277

Call stack:

----------------------------------------
-- Stack trace at ../Simple_string.hh:277
----------------------------------------
0x7F2D7FEEC184
0x7F2D7AC6BBDE connection_loop(void*)
0x7F2D7AC6F0FE NetworkConnection::run()
0x7F2D7AC6E0CB NetworkConnection::process_command(std::string const&)
0x7F2D7AC67CA7 FnCommand::run_command(NetworkConnection&,
std::vector<std::string, std::allocator<std::string> > const&)
0x45EA0F do_Assert(char const*, char const*, char const*, int)
========================================

SI stack:


==============================================================================
terminate called after throwing an instance of 'ErrorCode'

Process apl aborted
Post by Ala'a Mohammad
Hi,
I do not know if this is the same cause, but the assertion seems to be the same
in a new session do the following
- write an incorrect name like 'x.y'
- edit a function like 'z'
- save the function
- edit the z function again, and you get the failed assertion
: apl --version
---------
Project: GNU APL
Version / SVN: 1.7 / 1003M
Build Date: 2017-08-28 18:02:08 UTC
Build OS: Linux 3.13.0-37-generic x86_64
config.status: 'RATIONAL_NUMBERS_WANTED=yes'
Archive SVN: 989
----------------------------------
x.y
VALUE ERROR
x.y
^
∇z
∇z
==============================================================================
Assertion failed: items
in Function: at
in file: ../Simple_string.hh:277
----------------------------------------
-- Stack trace at ../Simple_string.hh:277
----------------------------------------
0x7F2ECE271184
0x7F2EC8FF0BDE connection_loop(void*)
0x7F2EC8FF40FE NetworkConnection::run()
0x7F2EC8FF30CB NetworkConnection::process_command(std::string const&)
0x7F2EC8FECCA7 FnCommand::run_command(NetworkConnection&,
std::vector<std::string, std::allocator<std::string> > const&)
0x45EA0F do_Assert(char const*, char const*, char const*, int)
========================================
Depth: 0
Exec: 0xbaf770
Safe exec: 0
Pmode: ◊ x.y
PC: 0 (5) 'y
Stat: x.y
err_code: 0x30001
thrown at: Symbol.cc:683
e_msg_1: 'VALUE ERROR'
e_msg_2: ' x.y'
e_msg_3: ' ^'
==============================================================================
terminate called after throwing an instance of 'ErrorCode'
Process apl aborted
Hope It Helps
Regards,
Ala'a
Post by Elias MÃ¥rtenson
If that's the case, then you are indeed right. It's possible that the
std::string constructor will work, but that would be more out of luck than
anything else.
Regards,
Elias
Hi Elias,
correct, except that an UCS8_string is not a string, despite of its name.
UCS8_strings have no terminating 0 byte; the 0-byte is only appended if
the UCS8_string is converted to a C string with function c_str().
/// Jürgen
Sorry for not replying earlier, I forgot about this message.
ucs[0] should be OK for an empty string, as that will still refer to the
terminating NUL byte at the end of the string. Note that an empty string is
differetn from a NULL pointer (the former is a valid string, and the other
is not).
Regards,
Elias
On 1 August 2017 at 19:04, Juergen Sauermann
Hi Elias,
/// return a UTF8 encoded std:string
inline std::string to_string(const UCS_string & ucs)
{
const UTF8_string utf(ucs);
return string((const char *)&utf[0], utf.size());
}
I am not sure what happens if string ucs is empty (in that case ucs[0]
does not
exist and may be makes &ucs[0] also 0. The std::string constructor then
looks
for the terminating 0 character in a 0-pointer. Using
UTF8:string::c_str() might
be better.
Also converting a UCS or UTF8 string to std::string just for outputting
it with << may be
an overkill, since ostream << often (read: after #include
"PrintOperator.hh") understands
UCF and UCS strings directly.
/// Jürgen
Can you tell me exactly what you are doing in order to reproduce the
problem?
Regards,
Elias
Elias Mårtenson
2017-08-30 08:25:54 UTC
Permalink
I thought JÃŒrgen fixed that? The cuase was apparently my misunderstanding
of how the GNU APL Simple_string works.

Regards,
Elias
Post by Ala'a Mohammad
Hi,
Trying to reduce the steps above to 'define, save, define' gives the
same thing above. This only happens when the defined function is saved
without a body (saved only with the header).
Network listener started. Connection information: mode:tcp addr:35039
∇x
∇x
============================================================
==================
Assertion failed: items
in Function: at
in file: ../Simple_string.hh:277
----------------------------------------
-- Stack trace at ../Simple_string.hh:277
----------------------------------------
0x7F2D7FEEC184
0x7F2D7AC6BBDE connection_loop(void*)
0x7F2D7AC6F0FE NetworkConnection::run()
0x7F2D7AC6E0CB NetworkConnection::process_command(std::string const&)
0x7F2D7AC67CA7 FnCommand::run_command(NetworkConnection&,
std::vector<std::string, std::allocator<std::string> > const&)
0x45EA0F do_Assert(char const*, char const*, char const*, int)
========================================
============================================================
==================
terminate called after throwing an instance of 'ErrorCode'
Process apl aborted
Post by Ala'a Mohammad
Hi,
I do not know if this is the same cause, but the assertion seems to be
the same
Post by Ala'a Mohammad
in a new session do the following
- write an incorrect name like 'x.y'
- edit a function like 'z'
- save the function
- edit the z function again, and you get the failed assertion
: apl --version
---------
Project: GNU APL
Version / SVN: 1.7 / 1003M
Build Date: 2017-08-28 18:02:08 UTC
Build OS: Linux 3.13.0-37-generic x86_64
config.status: 'RATIONAL_NUMBERS_WANTED=yes'
Archive SVN: 989
----------------------------------
x.y
VALUE ERROR
x.y
^
∇z
∇z
============================================================
==================
Post by Ala'a Mohammad
Assertion failed: items
in Function: at
in file: ../Simple_string.hh:277
----------------------------------------
-- Stack trace at ../Simple_string.hh:277
----------------------------------------
0x7F2ECE271184
0x7F2EC8FF0BDE connection_loop(void*)
0x7F2EC8FF40FE NetworkConnection::run()
0x7F2EC8FF30CB NetworkConnection::process_command(std::string const&)
0x7F2EC8FECCA7 FnCommand::run_command(NetworkConnection&,
std::vector<std::string, std::allocator<std::string> > const&)
0x45EA0F do_Assert(char const*, char const*, char const*, int)
========================================
Depth: 0
Exec: 0xbaf770
Safe exec: 0
Pmode: ◊ x.y
PC: 0 (5) 'y
Stat: x.y
err_code: 0x30001
thrown at: Symbol.cc:683
e_msg_1: 'VALUE ERROR'
e_msg_2: ' x.y'
e_msg_3: ' ^'
============================================================
==================
Post by Ala'a Mohammad
terminate called after throwing an instance of 'ErrorCode'
Process apl aborted
Hope It Helps
Regards,
Ala'a
Post by Elias MÃ¥rtenson
If that's the case, then you are indeed right. It's possible that the
std::string constructor will work, but that would be more out of luck
than
Post by Ala'a Mohammad
Post by Elias MÃ¥rtenson
anything else.
Regards,
Elias
On 8 August 2017 at 18:11, Juergen Sauermann <
Hi Elias,
correct, except that an UCS8_string is not a string, despite of its
name.
Post by Ala'a Mohammad
Post by Elias MÃ¥rtenson
UCS8_strings have no terminating 0 byte; the 0-byte is only appended if
the UCS8_string is converted to a C string with function c_str().
/// JÃŒrgen
Sorry for not replying earlier, I forgot about this message.
ucs[0] should be OK for an empty string, as that will still refer to
the
Post by Ala'a Mohammad
Post by Elias MÃ¥rtenson
terminating NUL byte at the end of the string. Note that an empty
string is
Post by Ala'a Mohammad
Post by Elias MÃ¥rtenson
differetn from a NULL pointer (the former is a valid string, and the
other
Post by Ala'a Mohammad
Post by Elias MÃ¥rtenson
is not).
Regards,
Elias
On 1 August 2017 at 19:04, Juergen Sauermann
Hi Elias,
/// return a UTF8 encoded std:string
inline std::string to_string(const UCS_string & ucs)
{
const UTF8_string utf(ucs);
return string((const char *)&utf[0], utf.size());
}
I am not sure what happens if string ucs is empty (in that case ucs[0]
does not
exist and may be makes &ucs[0] also 0. The std::string constructor
then
Post by Ala'a Mohammad
Post by Elias MÃ¥rtenson
looks
for the terminating 0 character in a 0-pointer. Using
UTF8:string::c_str() might
be better.
Also converting a UCS or UTF8 string to std::string just for
outputting
Post by Ala'a Mohammad
Post by Elias MÃ¥rtenson
it with << may be
an overkill, since ostream << often (read: after #include
"PrintOperator.hh") understands
UCF and UCS strings directly.
/// JÃŒrgen
Can you tell me exactly what you are doing in order to reproduce the
problem?
Regards,
Elias
Juergen Sauermann
2017-08-30 19:48:20 UTC
Permalink
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font face="Helvetica, Arial, sans-serif">Hi Elias,<br>
<br>
not really. I am only fetching your emacs code from time to time.<br>
I can't test it because I am on vi.<br>
<br>
Best Regards,<br>
Jürgen<br>
<br>
</font><br>
<div class="moz-cite-prefix">On 08/30/2017 10:25 AM, Elias Mårtenson
wrote:<br>
</div>
<blockquote
cite="mid:CADtN0WLg-x+***@mail.gmail.com"
type="cite">
<div dir="ltr">I thought Jürgen fixed that? The cuase was
apparently my misunderstanding of how the GNU APL Simple_string
works.
<div><br>
</div>
<div>Regards,</div>
<div>Elias</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 29 August 2017 at 03:45, Ala'a
Mohammad <span dir="ltr">&lt;<a moz-do-not-send="true"
href="mailto:***@gmail.com" target="_blank">***@gmail.com</a>&gt;</span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Trying to reduce the steps above to 'define, save, define'
gives the<br>
same thing above. This only happens when the defined
function is saved<br>
without a body (saved only with the header).<br>
<br>
Network listener started. Connection information: mode:tcp
addr:35039<br>
      ∇x<br>
      ∇x<br>
<span class=""><br>
==============================<wbr>==============================<wbr>==================<br>
Assertion failed: items<br>
in Function:      at<br>
in file:          ../Simple_string.hh:277<br>
<br>
Call stack:<br>
<br>
------------------------------<wbr>----------<br>
-- Stack trace at ../Simple_string.hh:277<br>
------------------------------<wbr>----------<br>
</span>0x7F2D7FEEC184<br>
0x7F2D7AC6BBDE  connection_loop(void*)<br>
0x7F2D7AC6F0FE   NetworkConnection::run()<br>
0x7F2D7AC6E0CB    NetworkConnection::process_<wbr>command(std::string
const&amp;)<br>
0x7F2D7AC67CA7     FnCommand::run_command(<wbr>NetworkConnection&amp;,<br>
<span class="im HOEnZb">std::vector&lt;std::string,
std::allocator&lt;std::string&gt; &gt; const&amp;)<br>
0x45EA0F      do_Assert(char const*, char const*, char
const*, int)<br>
==============================<wbr>==========<br>
<br>
SI stack:<br>
<br>
<br>
</span><span class="im HOEnZb">==============================<wbr>==============================<wbr>==================<br>
terminate called after throwing an instance of 'ErrorCode'<br>
<br>
Process apl aborted<br>
<br>
<br>
</span>
<div class="HOEnZb">
<div class="h5">On Mon, Aug 28, 2017 at 10:10 PM, Ala'a
Mohammad &lt;<a moz-do-not-send="true"
href="mailto:***@gmail.com">***@gmail.com</a>&gt;
wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; I do not know if this is the same cause, but the
assertion seems to be the same<br>
&gt;<br>
&gt; in a new session do the following<br>
&gt; - write an incorrect name like 'x.y'<br>
&gt; - edit a function like 'z'<br>
&gt; - save the function<br>
&gt; - edit the z function again, and you get the failed
assertion<br>
&gt;<br>
&gt; I'm running the latest APL version from svn:<br>
&gt; : apl --version<br>
&gt; BUILDTAG:<br>
&gt; ---------<br>
&gt;     Project:        GNU APL<br>
&gt;     Version / SVN:  1.7 / 1003M<br>
&gt;     Build Date:     2017-08-28 18:02:08 UTC<br>
&gt;     Build OS:       Linux 3.13.0-37-generic x86_64<br>
&gt;     config.status:  'RATIONAL_NUMBERS_WANTED=yes'<br>
&gt;     Archive SVN:    989<br>
&gt;<br>
&gt; Here is a session sample:<br>
&gt; ------------------------------<wbr>----<br>
&gt;<br>
&gt;       x.y<br>
&gt; VALUE ERROR<br>
&gt;       x.y<br>
&gt;         ^<br>
&gt;       ∇z<br>
&gt;       ∇z<br>
&gt;<br>
&gt; ==============================<wbr>==============================<wbr>==================<br>
&gt; Assertion failed: items<br>
&gt; in Function:      at<br>
&gt; in file:          ../Simple_string.hh:277<br>
&gt;<br>
&gt; Call stack:<br>
&gt;<br>
&gt; ------------------------------<wbr>----------<br>
&gt; -- Stack trace at ../Simple_string.hh:277<br>
&gt; ------------------------------<wbr>----------<br>
&gt; 0x7F2ECE271184<br>
&gt; 0x7F2EC8FF0BDE  connection_loop(void*)<br>
&gt; 0x7F2EC8FF40FE   NetworkConnection::run()<br>
&gt; 0x7F2EC8FF30CB    NetworkConnection::process_<wbr>command(std::string
const&amp;)<br>
&gt; 0x7F2EC8FECCA7     FnCommand::run_command(<wbr>NetworkConnection&amp;,<br>
&gt; std::vector&lt;std::string,
std::allocator&lt;std::string&gt; &gt; const&amp;)<br>
&gt; 0x45EA0F      do_Assert(char const*, char const*,
char const*, int)<br>
&gt; ==============================<wbr>==========<br>
&gt;<br>
&gt; SI stack:<br>
&gt;<br>
&gt; Depth:      0<br>
&gt; Exec:       0xbaf770<br>
&gt; Safe exec:  0<br>
&gt; Pmode:      ◊  x.y<br>
&gt; PC:         0 (5) 'y<br>
&gt; Stat:       x.y<br>
&gt; err_code:   0x30001<br>
&gt; thrown at:  Symbol.cc:683<br>
&gt; e_msg_1:    'VALUE ERROR'<br>
&gt; e_msg_2:    '      x.y'<br>
&gt; e_msg_3:    '        ^'<br>
&gt;<br>
&gt;<br>
&gt; ==============================<wbr>==============================<wbr>==================<br>
&gt; terminate called after throwing an instance of
'ErrorCode'<br>
&gt;<br>
&gt; Process apl aborted<br>
&gt;<br>
&gt;<br>
&gt; Hope It Helps<br>
&gt;<br>
&gt; Regards,<br>
&gt;<br>
&gt; Ala'a<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Aug 8, 2017 at 2:18 PM, Elias Mårtenson
&lt;<a moz-do-not-send="true"
href="mailto:***@gmail.com">***@gmail.com</a>&gt;
wrote:<br>
&gt;&gt; If that's the case, then you are indeed right.
It's possible that the<br>
&gt;&gt; std::string constructor will work, but that
would be more out of luck than<br>
&gt;&gt; anything else.<br>
&gt;&gt;<br>
&gt;&gt; Regards,<br>
&gt;&gt; Elias<br>
&gt;&gt;<br>
&gt;&gt; On 8 August 2017 at 18:11, Juergen Sauermann
&lt;<a moz-do-not-send="true"
href="mailto:***@t-online.de">***@t-online.de</a><wbr>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Hi Elias,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; correct, except that an UCS8_string is not
a string, despite of its name.<br>
&gt;&gt;&gt; UCS8_strings have no terminating 0 byte;
the 0-byte is only appended if<br>
&gt;&gt;&gt; the UCS8_string is converted to a C string
with function c_str().<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; /// Jürgen<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On 08/08/2017 09:28 AM, Elias Mårtenson
wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Sorry for not replying earlier, I forgot
about this message.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; ucs[0] should be OK for an empty string, as
that will still refer to the<br>
&gt;&gt;&gt; terminating NUL byte at the end of the
string. Note that an empty string is<br>
&gt;&gt;&gt; differetn from a NULL pointer (the former
is a valid string, and the other<br>
&gt;&gt;&gt; is not).<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Regards,<br>
&gt;&gt;&gt; Elias<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On 1 August 2017 at 19:04, Juergen
Sauermann<br>
&gt;&gt;&gt; &lt;<a moz-do-not-send="true"
href="mailto:***@t-online.de">***@t-online.de</a><wbr>&gt;
wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Hi Elias,<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I don't know what Ala'a did. However,
looking at:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; /// return a UTF8 encoded std:string<br>
&gt;&gt;&gt;&gt; inline std::string to_string(const
UCS_string &amp; ucs)<br>
&gt;&gt;&gt;&gt; {<br>
&gt;&gt;&gt;&gt;     const UTF8_string utf(ucs);<br>
&gt;&gt;&gt;&gt;     return string((const char
*)&amp;utf[0], utf.size());<br>
&gt;&gt;&gt;&gt; }<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I am not sure what happens if string
ucs is empty (in that case ucs[0]<br>
&gt;&gt;&gt;&gt; does not<br>
&gt;&gt;&gt;&gt; exist and may be makes &amp;ucs[0] also
0. The std::string constructor then<br>
&gt;&gt;&gt;&gt; looks<br>
&gt;&gt;&gt;&gt; for the terminating 0 character in a
0-pointer. Using<br>
&gt;&gt;&gt;&gt; UTF8:string::c_str() might<br>
&gt;&gt;&gt;&gt; be better.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Also converting a UCS or UTF8 string to
std::string just for outputting<br>
&gt;&gt;&gt;&gt; it with &lt;&lt; may be<br>
&gt;&gt;&gt;&gt; an overkill, since ostream &lt;&lt;
often (read: after #include<br>
&gt;&gt;&gt;&gt; "PrintOperator.hh") understands<br>
&gt;&gt;&gt;&gt; UCF and UCS strings directly.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; /// Jürgen<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; On 07/31/2017 02:31 AM, Elias Mårtenson
wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Can you tell me exactly what you are
doing in order to reproduce the<br>
&gt;&gt;&gt;&gt; problem?<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Regards,<br>
&gt;&gt;&gt;&gt; Elias<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>

Loading...