On Thursday, 22 April 2021 at 21:15:48 UTC, tcak wrote:
string fileContent = "";
...
[...]
Do you have a minimal reproducible test case? 🤔
On Friday, 23 April 2021 at 00:44:58 UTC, tcak wrote:
As far as I see, it is not related to that array or indices at
all.
The question of where is to see if it was CTFE allocated or
runtime allocated. I don't think it should make a difference here
but idk.
If there is no known situation th
On Friday, 23 April 2021 at 00:30:02 UTC, Adam D. Ruppe wrote:
On Thursday, 22 April 2021 at 21:15:48 UTC, tcak wrote:
"positions" array is defined as auto positions = new float[
100 ]; So, I am 100% sure, it is not out of range. "ri*dim +
1" is not a big number at all.
Oh and *where* is that
On Thursday, 22 April 2021 at 21:15:48 UTC, tcak wrote:
"positions" array is defined as auto positions = new float[ 100
]; So, I am 100% sure, it is not out of range. "ri*dim + 1" is
not a big number at all.
Oh and *where* is that positions variable defined?
Are there any other threads in your program?
In other parts of the code, concatenation operations are all
failing with same error. I need guidance to get out of this
situation. My assumption was that as long as there is empty heap
memory, concatenation operation would succeed always. But, it
doesn't seem like so.
ll allocation. I remember I had
this problem before in another project.
I have enough free ram. htop shows 3.96 GiB of 8 GiB is used only
and swap is not in use.
DMD64 D Compiler v2.094.0
Is this error related to me? Is it a programmer error? Is it a
bug? Am I doing something wrong? This is a compiler related
operation (string concatenation), and I assume/expect that it
would work without a problem.
On Friday, 14 July 2017 at 00:40:38 UTC, FoxyBrown wrote:
Anyone have an efficient implementation that is easy to use?
If you are OK with just a range spanning the two or more strings,
then you could use chain as is.
On Friday, 14 July 2017 at 00:40:38 UTC, FoxyBrown wrote:
Anyone have an efficient implementation that is easy to use?
Not sure what you mean by efficient here, but a \theta(n+m) one
is done idiomatically with Allocator+ranges like this (note that
the casts to and from ubyte are necessary, be
Anyone have an efficient implementation that is easy to use?
On Friday, 4 November 2016 at 14:56:46 UTC, Guillaume Piolat
wrote:
On Friday, 4 November 2016 at 14:55:27 UTC, Guillaume Piolat
wrote:
On Thursday, 3 November 2016 at 18:54:14 UTC, Gary Willoughby
wrote:
What is the simplest way of doing @nogc string concatenation?
I use sprintf + zero
On Friday, 4 November 2016 at 14:55:27 UTC, Guillaume Piolat
wrote:
On Thursday, 3 November 2016 at 18:54:14 UTC, Gary Willoughby
wrote:
What is the simplest way of doing @nogc string concatenation?
I use sprintf + zero-terminated strings (or a RAII struct to
convert slices to ZT strings
On Thursday, 3 November 2016 at 18:54:14 UTC, Gary Willoughby
wrote:
What is the simplest way of doing @nogc string concatenation?
I use sprintf + zero-terminated strings (or a RAII struct to
convert slices to ZT strings).
On 11/3/16 2:54 PM, Gary Willoughby wrote:
What is the simplest way of doing @nogc string concatenation?
Where does it go?
For instance, this should work:
auto newstr = "hello, ".chain("world");
-Steve
On Thursday, November 03, 2016 18:54:14 Gary Willoughby via Digitalmars-d-
learn wrote:
> What is the simplest way of doing @nogc string concatenation?
std.range.chain is the closest that you're going to get with actual strings.
Dynamic arrays require the GC to do concatenation, because t
What is the simplest way of doing @nogc string concatenation?
On Monday, 30 March 2015 at 17:34:20 UTC, Suliman wrote:
string sss = format("foo"-", ""bar");
It should be obvious now that you forgot to escape those
double quotes.
Thanks! Is there any way to stay string as is. without need of
it's escaping and so on?
It's seems I have seen something li
string sss = format("foo"-", ""bar");
It should be obvious now that you forgot to escape those double
quotes.
Thanks! Is there any way to stay string as is. without need of
it's escaping and so on?
It's seems I have seen something like it in docs, but I am not
sure about it...
On Monday, 30 March 2015 at 17:18:01 UTC, Suliman wrote:
same problem. I am preparing string to next SQL request:
string sss = format("SELECT * FROM test.imgs WHERE src LIKE
CONCAT('%', REPLACE(CAST(CURDATE()as char), "-", ""), '%') OR
CONCAT('%', CAST(CURDATE()as char), '%')");
Here's your
same problem. I am preparing string to next SQL request:
string sss = format("SELECT * FROM test.imgs WHERE src LIKE
CONCAT('%', REPLACE(CAST(CURDATE()as char), "-", ""), '%') OR
CONCAT('%', CAST(CURDATE()as char), '%')");
but I am getting next error:
source\app.d(178): Error: invalid array
what if a_college[i] will contain ` char?
almost SQL have "prepare" statement...
std.string.format interpolates string with the same behavior as
writefln
Thanks!
Please show the _clean_ input, followed by an output example.
Bye,
bearophile
to prevent visual corruption I had past it here:
http://www.everfall.com/paste/id.php?ftzy9lxr6yfy
Just FYI use prepared statements instead of string concatenation
for SQL queries.
You mean some tools, that
On Wed, 07 Jan 2015 16:38:23 +, Suliman wrote:
> I except that writefln have some behavior as string concatenation, but
> it does not.
>
> IS there any way to put needed values in place of %s in string?
std.string.format interpolates string with the same behavior as writefln
;, '%s', '%s',
'%s', '%s', '%s');", date[i], a_fredericksburg[i],
fredericksburg[i], a_college[i], college[i], a_planetary[i],
planetary[i]);
I except that writefln have some behavior as string
concatenation, but it does not.
IS ther
27;%s', '%s', '%s');", date[i], a_fredericksburg[i],
fredericksburg[i], a_college[i], college[i], a_planetary[i],
planetary[i]);
I except that writefln have some behavior as string
concatenation, but it does not.
IS there any way to put needed values in place of %s
%s', '%s');", date[i], a_fredericksburg[i], fredericksburg[i],
a_college[i], college[i], a_planetary[i], planetary[i]);
I except that writefln have some behavior as string
concatenation, but it does not.
IS there any way to put needed values in place of %s in string?
On 11/16/2013 08:59 AM, ilya-stromberg wrote:
> I think it's good to listen a little critics from newcomers. I belive
> that it helps Ali Cehreli to improve the book.
Exactly! :) Two quotes from the Introduction chapter:
"If you come across chapters that you find to be particularly difficult,
On Friday, 15 November 2013 at 23:51:42 UTC, Jacek Furmankiewicz
wrote:
Thanks for the book! I printed it, all 673 pages of it. Immense
work you have there.
I think it's good to listen a little critics from newcomers. I
belive that it helps Ali Cehreli to improve the book.
Also, you can use
On Friday, 15 November 2013 at 22:33:34 UTC, Brad Anderson wrote:
Appender in std.array is probably what you are looking for.
std.algorithm.joiner is also useful (no allocations at all
even) but the use case is a bit different.
Is Appender considered up to Phobos' current standards? I vaguely
Thanks for the book! I printed it, all 673 pages of it. Immense
work you have there.
On 11/15/2013 02:35 PM, Jacek Furmankiewicz wrote:
> "Programming in D" PDF and he did not show this in his initial chapter on
> Strings.
Sorry about that. :)
As I was targeting novices to programming, I tried to give as much as
needed but as little as possible, so that the reader would not be
On Friday, 15 November 2013 at 22:35:48 UTC, Jacek Furmankiewicz
wrote:
I am learning D by going through Ali Cehreli's otherwise
excellent "Programming in D" PDF and he did not show this in
his initial chapter on Strings.
Well, Appender is not string specific.
D feels like being in a differen
Thank you all.
I am learning D by going through Ali Cehreli's otherwise
excellent "Programming in D" PDF and he did not show this in his
initial chapter on Strings.
On Fri, 15 Nov 2013 22:30:35 +, Justin Whear wrote:
> std.array has an Appender type that can be used to build up a string (or
> any other array type) efficiently.
Oh, and if you have an idea of how large the result might grow, be sure
to use the reserve() method on the appender.
On Friday, 15 November 2013 at 22:26:20 UTC, Jacek Furmankiewicz
wrote:
Since D strings are immutable (like in most other languages),
string concatenation is usually pretty inefficient due to the
need to create a new copy of the string every time.
I presume string concatenation using the
On Fri, 15 Nov 2013 23:26:19 +0100, Jacek Furmankiewicz wrote:
> Since D strings are immutable (like in most other languages), string
> concatenation is usually pretty inefficient due to the need to create a
> new copy of the string every time.
>
> I presume string concaten
Since D strings are immutable (like in most other languages),
string concatenation is usually pretty inefficient due to the
need to create a new copy of the string every time.
I presume string concatenation using the typical array syntax can
be optimized by the compiler to do all of this in
On Fri, 21 Jun 2013 06:14:38 -0400, Jonathan M Davis
wrote:
On Friday, June 21, 2013 12:09:09 Gary Willoughby wrote:
Have you any tips for using D when you need fast string
concatenation? I regularly use code like this:
foreach (i, range)
{
foo ~= bar;
}
or
It's worth pointing out that Appender supports ~= so it's very
easy to swap it in, replacing builtin concatenation.
This works since 2.062 AFAIK. So is still quite new.
On Friday, 21 June 2013 at 11:33:29 UTC, monarch_dodra wrote:
On Friday, 21 June 2013 at 10:09:10 UTC, Gary Willoughby wrote:
Have you any tips for using D when you need fast string
concatenation? I regularly use code like this:
foreach (i, range)
{
foo ~= bar;
}
or:
foo
On Friday, 21 June 2013 at 10:09:10 UTC, Gary Willoughby wrote:
Have you any tips for using D when you need fast string
concatenation? I regularly use code like this:
foreach (i, range)
{
foo ~= bar;
}
or:
foo = foo ~ bar ~ baz ~ qux;
I've used std.string.f
On Friday, June 21, 2013 12:09:09 Gary Willoughby wrote:
> Have you any tips for using D when you need fast string
> concatenation? I regularly use code like this:
>
> foreach (i, range)
> {
> foo ~= bar;
> }
>
> or:
>
> foo = foo
On Friday, 21 June 2013 at 10:09:10 UTC, Gary Willoughby wrote:
Are there faster ways of appending strings?
You'll want to use appender, from std.array:
http://dlang.org/phobos/std_array.html#.Appender
Have you any tips for using D when you need fast string
concatenation? I regularly use code like this:
foreach (i, range)
{
foo ~= bar;
}
or:
foo = foo ~ bar ~ baz ~ qux;
I've used std.string.format(...) in some instances which sped
things up which surpris
On Sun, 08 Apr 2012 01:08:09 -0400, dnewbie wrote:
I have a wchar[] and I want to convert it to UTF8
then append a string. This is my code.
import std.c.windows.windows;
import std.string;
import std.utf;
int main()
{
wchar[100] v;
v[0] = 'H';
v[1] = 'e';
v[2] = 'l';
v[3] = 'l'
On Sunday, 8 April 2012 at 05:08:15 UTC, dnewbie wrote:
wchar[100] v;
v[0] = 'H';
v[1] = 'e';
v[2] = 'l';
v[3] = 'l';
v[4] = 'o';
v[5] = 0;
string s = toUTF8(v) ~ ", world!";
MessageBoxA(null, s.toStringz, "myapp", MB_OK);
Hint: You normally don't use fixed-length arr
On Sunday, 8 April 2012 at 05:27:50 UTC, Jonathan M Davis wrote:
On Sunday, April 08, 2012 07:08:09 dnewbie wrote:
I have a wchar[] and I want to convert it to UTF8
then append a string. This is my code.
import std.c.windows.windows;
import std.string;
import std.utf;
int main()
{
wchar[100
dnewbie:
string s = toUTF8(v) ~ ", world!";
MessageBoxA(null, s.toStringz, "myapp", MB_OK);
return 0;
}
I suggest to compile all your code with -property plus -w (or
-wi), unless you have some specific needs to not do it.
Bye,
bearophile
On 4/8/12, dnewbie wrote:
> I have a wchar[] and I want to convert it to UTF8
> then append a string. This is my code.
>
> import std.c.windows.windows;
> import std.string;
> import std.utf;
>
> int main()
> {
>wchar[100] v;
>v[0] = 'H';
>v[1] = 'e';
>v[2] = 'l';
>v[3] = 'l';
On Sunday, April 08, 2012 07:08:09 dnewbie wrote:
> I have a wchar[] and I want to convert it to UTF8
> then append a string. This is my code.
>
> import std.c.windows.windows;
> import std.string;
> import std.utf;
>
> int main()
> {
>wchar[100] v;
>v[0] = 'H';
>v[1] = 'e';
>v[2]
I have a wchar[] and I want to convert it to UTF8
then append a string. This is my code.
import std.c.windows.windows;
import std.string;
import std.utf;
int main()
{
wchar[100] v;
v[0] = 'H';
v[1] = 'e';
v[2] = 'l';
v[3] = 'l';
v[4] = 'o';
v[5] = 0;
string s = toUTF8(v) ~
Alex wrote:
Hey,
I got a problem after concatenating two strings:
void main()
{
while(true) // For faking high program activity...
{
string t="Do";
string t2="That"
foo(t,t2);
delete t;
delete t2;
No
I am using D1, while you probably use D2. I have compiled the following code
with -O -release -inline, with the last DMD 1.x:
import std.stdio: writefln;
void foo(string s1, string s2) {
string con = s1 ~ s2;
writefln(con);
}
void main() {
while(true) {
string t1 = "Do";
Hey,
I got a problem after concatenating two strings:
void main()
{
while(true) // For faking high program activity...
{
string t="Do";
string t2="That"
foo(t,t2);
delete t;
delete t2;
}
}
void fo
55 matches
Mail list logo