I'll be trying to narrow it down even more tomorrow, but I was
hoping somone here might have some insight into this weird issue
I am having.
I have a dynamic array of shorts that I had been trying to append
to (capturing sound data). I kept getting a segfault when doing
the append, and have
I should also mention that this is on Linux. I haven't tried on
OSX or Windows yet.
On Saturday, 13 December 2014 at 08:59:19 UTC, Jeremy DeHaan
wrote:
for(int i = 0; isamples.length; ++i)
m_samples.length +=1;
You are testing i against an ever-increasing limit aren't you, so
it's an infinite loop.
On Saturday, 13 December 2014 at 09:24:51 UTC, Paul wrote:
On Saturday, 13 December 2014 at 08:59:19 UTC, Jeremy DeHaan
wrote:
for(int i = 0; isamples.length; ++i)
m_samples.length +=1;
You are testing i against an ever-increasing limit aren't you,
so it's an infinite
On Saturday, 13 December 2014 at 09:24:51 UTC, Paul wrote:
You are testing i against an ever-increasing limit aren't you,
so it's an infinite loop.
Read more carefully. samples is unmodified, it's m_samples whose
length is changed.
On Saturday, 13 December 2014 at 08:59:19 UTC, Jeremy DeHaan
wrote:
I'll be trying to narrow it down even more tomorrow, but I was
hoping somone here might have some insight into this weird
issue I am having.
Could you upload the code to somewhere? With only a small
snippet, it's hard to get
On Saturday, December 13, 2014 02:34:21 Jeremy DeHaan via Digitalmars-d-learn
wrote:
Is this on purpose? Granted, I almost never use interface files,
but I had a whim to use them for what I was working on today.
Everything worked fine when I renamed the file to package.d, but
apparently
ketmar:
no, you are using `.byLine` incorrectly. ;-) `.byLine` reuses
it's
internal buffer for each line, so you have to copy that buffer.
A simple solution is to use byLineCopy (that unfortunately should
have been the default behavior since the beginning).
Bye,
bearophile
Is there a standard way to do this? The code below is untested, as I
haven't yet written the x7to8 routine, and came up with a better way to
do what this was to accomplish, but it feels as if this should be
somewhere in the standard library, if I could only find it.
/** Repack the data from
On Sat, 13 Dec 2014 10:01:49 +
bearophile via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
no, you are using `.byLine` incorrectly. ;-) `.byLine` reuses
it's
internal buffer for each line, so you have to copy that buffer.
A simple solution is to use byLineCopy (that
On Friday, 12 December 2014 at 19:35:26 UTC, Steven Schveighoffer
wrote:
On 12/12/14 2:17 PM, H. S. Teoh via Digitalmars-d-learn wrote:
On Fri, Dec 12, 2014 at 11:13:38AM -0500, Steven Schveighoffer
via Digitalmars-d-learn wrote:
On 12/12/14 8:39 AM, Trollgeir wrote:
On Saturday, 13 December 2014 at 10:09:27 UTC, Charles Hixson via
Digitalmars-d-learn wrote:
Is there a standard way to do this? The code below is
untested, as I haven't yet written the x7to8 routine, and came
up with a better way to do what this was to accomplish, but it
feels as if this
On Saturday, 13 December 2014 at 11:20:21 UTC, Manolo wrote:
On Saturday, 13 December 2014 at 10:09:27 UTC, Charles Hixson
via Digitalmars-d-learn wrote:
Is there a standard way to do this? The code below is
untested, as I haven't yet written the x7to8 routine, and came
up with a better way
import std.stdio, core.thread;
struct Tree{
int val;
Tree[] tree;
}
struct TreeRange{
Tree curtree;
bool empty;
Fiber worker;
this(Tree t){
worker = new Fiber(fiberFunc);
curtree = t;
popFront();
}
void fiberFunc(){
Tree t = curtree;
Fiber.yield();
On Saturday, 13 December 2014 at 06:40:41 UTC, ketmar via
Digitalmars-d-learn wrote:
.map!a.idup
That can be just .map!idup.
On Sat, 13 Dec 2014 12:07:27 +
thedeemon via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
On Saturday, 13 December 2014 at 06:40:41 UTC, ketmar via
Digitalmars-d-learn wrote:
.map!a.idup
That can be just .map!idup.
it depends of compiler version, as `idup` was a
When you assigning the worker in TreeRange, you create a delegate
that captures the current TreeRange or 'this'.
---
worker = new Fiber(fiberFunc);
---
foreach is defined as
(http://dlang.org/statement.html#ForeachStatement):
---
for (auto __r = range; !__r.empty; __r.popFront())
{
On 13.12.14 13:01, zeljkog wrote:
void main() {
auto tt = Tree(5, [Tree(7,[Tree(11), Tree(4)]), Tree(10)]);
auto tr1 = TreeRange(tt);
foreach(v; tr1){
writef(%2d, , v);
}
writeln();
for(auto r = TreeRange(tt); !r.empty; r.popFront())
writef(%2d, , r.front);
On Saturday, 13 December 2014 at 12:26:49 UTC, zeljkog wrote:
On 13.12.14 13:01, zeljkog wrote:
void main() {
auto tt = Tree(5, [Tree(7,[Tree(11), Tree(4)]), Tree(10)]);
auto tr1 = TreeRange(tt);
foreach(v; tr1){
writef(%2d, , v);
}
writeln();
for(auto r = TreeRange(tt);
On Saturday, 13 December 2014 at 09:47:40 UTC, Artem Tarasov
wrote:
On Saturday, 13 December 2014 at 08:59:19 UTC, Jeremy DeHaan
wrote:
I'll be trying to narrow it down even more tomorrow, but I was
hoping somone here might have some insight into this weird
issue I am having.
Could you
I'm writing bindings to a rather big C library where the return
values of almost all functions indicate the possibility of an
error (exception).
Assuming there's a C header, foo.h with functions f1, f2,
etc, I want to have a corresponding D module, foo.d which would
provide the f1, f2 that
On Saturday, 13 December 2014 at 16:34:42 UTC, aldanor wrote:
I'm writing bindings to a rather big C library where the return
values of almost all functions indicate the possibility of an
error (exception).
Assuming there's a C header, foo.h with functions f1, f2,
etc, I want to have a
If I right understand scope is not good for checking if one of
function is fail.
For example:
string dbpass = config.getKey(dbpass);
string dbpass = config.getKey(dbpass);
string dbhost = config.getKey(dbhost);
string dbport = config.getKey(dbport);
if I will try to add scope(failure)
Personally i wouldn't go this route. I would create foo.d as a
C to D translation only so it can be imported and used like in
C. Then i would create another module which imports this to
create your new OOP API adding features and excepions, etc.
This allows the best of both worlds, keep the C
I reread docs and understood that scope not for such case.
Next code is do what I need:
try
{
string dbname = config.getKey(dbname);
string dbpass = config.getKey(dbpass);
string dbhost = config.getKey(dbhost);
string dbport = config.getKey(dbport);
}
catch
On the code.dlang.org I found SQLLite driver
https://github.com/biozic/d2sqlite3
Look like it's not ready for Windows:
pragma(msg, \nWARNING !!!\nDevelopped for POSIX systems
only.\nNot tested on Windows.\n);
I tried to add import to my project and I got next errors:
On Saturday, 13 December 2014 at 19:03:42 UTC, aldanor wrote:
Let's say there's a foo.d that contains raw bindings to
foo.h (enums, structs, extern variables, function
declarations, a whole load of stuff) -- everything but the
functions is already fine but all functions need to be wrapped.
On Saturday, 13 December 2014 at 19:52:33 UTC, Charles Hixson via
Digitalmars-d-learn wrote:
On 12/13/2014 03:20 AM, Manolo via Digitalmars-d-learn wrote:
On Saturday, 13 December 2014 at 10:09:27 UTC, Charles Hixson
via Digitalmars-d-learn wrote:
Is there a standard way to do this? The code
import std.stdio;
class ObjectAType {
bool ok;
this() {ok = true;}
}
void main()
{
auto a = new ObjectAType;
assert(a.ok);
destroy(a);
assert(!a.ok); // a has been destroyed.
}
This method of detection of collected objects is what I needed.
Thanks to everybody for
Is there a Phobos method/range for selecting all pairs out of a
range without caring about the ordering within each pair?
Example:
[1,2,3] = [(1,2), (2,3), (3,1)]
On 12/14/2014 4:03 AM, aldanor wrote:
However, it wouldn't be
possible to retain the same function names since they've been imported
to the namespace (it's then also not possible to extern them as private
initially since then you won't be able to import/wrap them in a
different module). Hence
On Sat, Dec 13, 2014 at 10:24:50PM +, Nordlöw via Digitalmars-d-learn
wrote:
Is there a Phobos method/range for selecting all pairs out of a range
without caring about the ordering within each pair?
Example:
[1,2,3] = [(1,2), (2,3), (3,1)]
Sounds like:
On Saturday, 13 December 2014 at 23:08:13 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
[1,2,3] = [(1,2), (2,3), (3,1)]
Sounds like:
https://issues.dlang.org/show_bug.cgi?id=6788
Thx.
On 14/12/2014 9:21 a.m., Suliman wrote:
On the code.dlang.org I found SQLLite driver
https://github.com/biozic/d2sqlite3
Look like it's not ready for Windows:
pragma(msg, \nWARNING !!!\nDevelopped for POSIX systems only.\nNot
tested on Windows.\n);
I tried to add import to my project and I
On Saturday, 13 December 2014 at 06:40:41 UTC, ketmar via
Digitalmars-d-learn wrote:
auto names = File(names.txt)
.byLine!(char,char)(KeepTerminator.no, ',')
.map!a.idup
.array;
Awesome. map!idup does the trick.
I had looked at the byLine doc before posting, in
Yes I used 2.0.65, but after updating compiler the situation did
not resolved...
http://www.everfall.com/paste/id.php?apd0bfs5z4eg
On 14/12/2014 7:35 p.m., Suliman wrote:
Yes I used 2.0.65, but after updating compiler the situation did not
resolved...
http://www.everfall.com/paste/id.php?apd0bfs5z4eg
Ah oh, I remember this issue from 2.064 - 2.065.
Definitely hasn't been upgraded.
37 matches
Mail list logo