On Tuesday, 26 January 2016 at 21:21:29 UTC, Igor wrote:
That shouldn't be the case. I allocate in a static method
called New once. I then deallocate in the destructor. Basically
just as one would do in C++.
You can't deallocate in destructor in C++, because an object can
be embedded in anoth
On Wednesday, 27 January 2016 at 22:39:54 UTC, Igor wrote:
Ultimately I want no GC dependency. Is there an article that
shows how this can be done?
You can link with gcstub
https://github.com/D-Programming-Language/druntime/blob/master/src/gcstub/gc.d it will replace GC completely.
Alias templates require stack pointer, init probably has it set
to null.
Try this:
FooType foo = FooType();
On Sunday, 31 January 2016 at 02:58:28 UTC, Andrew Edwards wrote:
void notUsed(T)(T v) { return cast(void)0; };
since it always returns cast(void)0 regardless of the input.
But it cannot be that simple, so what am I missing?
Now notUsed has an unused parameter v.
http://dpaste.dzfl.pl/f888feb6f743
On Thursday, 4 February 2016 at 14:25:21 UTC, bachmeier wrote:
Unfortunately there is no such thing and it is unlikely to
exist in the next decade.
There is http://forum.dlang.org/post/mtsd38$16ub$1...@digitalmars.com
https://dlang.org/phobos/core_thread.html#.Thread.join
Yep, munching an Error by default is pretty nasty.
I'd say support for this scenario is not implemented yet.
On Saturday, 6 February 2016 at 08:07:42 UTC, NX wrote:
What language semantics prevent precise
Lack of resources. Precise GC needs to know which fields are
pointers. Somebody must generate that map. AFAIK there was an
experiment on that.
fast GC
Fast GC needs to be notified about pointe
http://dpaste.dzfl.pl/1f25ac34c1ee
You need Tuple, not Algebraic. Algebraic stores only one value of
one type from a set, like Variant.
On Tuesday, 9 February 2016 at 21:03:34 UTC, anonymous wrote:
What's up with that garbled text?
https://issues.dlang.org/show_bug.cgi?id=2742
https://dlang.org/phobos/std_container.html and corresponding
code in phobos. Though recently allocators were introduced and
containers are going to be written with support for allocators.
On Friday, 19 February 2016 at 05:41:01 UTC, jmh530 wrote:
void main()
{
import std.stdio : writeln;
auto foo_bar = foo(&bar);
writeln(qux(1, 2, foo_bar)); //compiler error
writeln(qux(1, 2, &baz));
}
int bar(int x)
{
return x;
}
int baz(int x,
Currently it crashes:
https://issues.dlang.org/show_bug.cgi?id=1180
http://pastebin.com/JfPtGTD8 ?
Oops, no, looks like you can't put HTTP in a class, because it
works with GC and is ref counted.
void diss(int n)(ref int[n] array) { }
But to consume array of any size, just take dynamic array as
parameter.
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-helloworld.html#section-helloworld
- Hello world.
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/index.html
- GStreamer Application Development Manual
http://docs.gstreamer.com/display/GstSDK/Bas
On Wednesday, 9 March 2016 at 18:35:31 UTC, KlausO wrote:
So maybe they should be declared as "extern GUID ..." because
they also seem to be defined in windows\lib\uuid.lib which
comes with DMD.
Declarations come from mingw and mingw doesn't have uuid.lib:
https://issues.dlang.org/show_bug.cg
Oh, it was
https://github.com/D-Programming-Language/druntime/pull/1472
On Monday, 14 March 2016 at 14:19:27 UTC, stunaep wrote:
I'm on my phone but I think It said something like
Deprecation: module std.stdio not accessible from here. Try
import static std.stdio
That's fix for bug https://issues.dlang.org/show_bug.cgi?id=313
See the code where std.stdio is not ac
The same as you would do it in C.
On Tuesday, 15 March 2016 at 17:12:44 UTC, Suliman wrote:
On Tuesday, 15 March 2016 at 15:01:09 UTC, Kagamin wrote:
The same as you would do it in C.
I do not know C :(
Please explain me what i should to do with this binding
C is mostly the same as low-level subset of D: primitive types,
p
When a string is not an in parameter, it can't be declared `in
char[]`.
Mingw or windows platform SDK.
Also there's ODBC driver
http://www.firebirdsql.org/en/devel-odbc-driver/ - you can use
it, phobos has ODBC bindings.
Latest version of what? ODBC bindings are in phobos:
http://dlang.org/phobos/etc_c_odbc_sql.html
You can also look here
https://github.com/cruisercoder/dstddb/blob/master/src/std/database/odbc/database.d for an example of accessing ODBC from D (only strings are supported so far).
AFAIK when you request a string, whatever value is there gets
converted to string. Or you can just add code to extract blobs,
that would be less effort than writing everything from scratch.
On Monday, 4 April 2016 at 11:32:23 UTC, Rene Zwanenburg wrote:
https://issues.dlang.org/show_bug.cgi?id=1983
Bug 1983 is about usage of delegates after creation, restrictions
during creation are enforced. AIU, OP wants to have const check
during creation.
On Tuesday, 5 April 2016 at 01:21:55 UTC, Thalamus wrote:
I am invoking an entry point in a D DLL from C# (via extern
(C)), and one of the parameters is a string. This works just
fine for ANSI, but I'm having trouble with the Unicode
equivalent.
When the message parameter is wchar*, wstring i
On Tuesday, 5 April 2016 at 10:30:58 UTC, Suliman wrote:
http://www.symmetricds.org/issues/view.php?id=2439
http://www.postgresql.org/docs/9.5/static/ecpg-sql-set-autocommit.html -
doesn't look deprecated or anything.
Create a range that would remove the newline characters from
string, then decode from that.
chomp only trims the string at the beginning and at the end, not
in the middle.
https://randomascii.wordpress.com/2012/12/29/the-surprising-subtleties-of-zeroing-a-register/
But there was at least one out-of-order design that did not
recognize xor reg, reg as a special case: the Pentium Pro. The
Intel Optimization manuals for the Pentium Pro recommended
“mov” to zero a reg
You can write it in code:
version(unittest)
static assert(false,"unit tests not supported");
http://wiki.dlang.org/Libraries_and_Frameworks#GUI_Libraries
enum
{
// 12 others ...
INSTALLMESSAGE_INITIALIZE ,
INSTALLMESSAGE_TERMINATE ,
INSTALLMESSAGE_SHOWDIALOG
}
static if(_WIN32_MSI >= 500)
enum INSTALLMESSAGE_PERFORMANCE=15;
static if(_WIN32_MSI >= 400)
enum INSTALLMESSAGE_RMFILESINUSE=16;
static if(_WIN32_MSI >= 450
On Thursday, 28 April 2016 at 22:54:10 UTC, Jesse Phillips wrote:
This one doesn't get the values right for the different
versions. The other problem is functions are written as:
void* something(INSTALLMESSAGE arg);
So I could make all the functions take an int/uint or such, but
that is a
On Thursday, 5 May 2016 at 08:19:26 UTC, chmike wrote:
At the bottom of the wiki page there is an innocent question
regarding TLS which is quite devastating. A worker thread pool
system would not support affinity between threads and callback
context. Unfortunately, D relies on Thread Local Stor
On Friday, 6 May 2016 at 12:08:29 UTC, chmike wrote:
In some applications and event types the synchronization
overhead is small compared to the benefit of executing tasks in
parallel on different cores.
GUI generates too many messages that are handled too fast -
synchronization overhead would
On Thursday, 12 May 2016 at 22:51:17 UTC, Andrew Edwards wrote:
The following preprocessor directives are frequently
encountered in C code, providing a default constant value where
the user of the code has not specified one:
#ifndef MIN
#define MIN 99
#endif
On Monday, 16 May 2016 at 17:08:32 UTC, chmike wrote:
- There is no need to preallocate a buffer for all input
channels that can stay idle for a long time. This doesn't scale
well to million connections.
Can you request one byte and then read what was buffered?
I'd say do something like https://dpaste.dzfl.pl/e9a2327ff2a1
Any idea why it crashes?
how this works?
double[] generateValues(ref Random rand, int l)
{
auto values = new double[](l);
foreach (ref val; values)
{
auto value = 1;
if (uniform(0, 2, rand))
{
value = value * -1;
Does this work?
Request rq = Request();
Response rs = rq.exec!"GET"("http://somewebpage.org/";,
[parameter:data]);
On Friday, 20 May 2016 at 14:06:54 UTC, chmike wrote:
But when I try to instantiate the class I get an dramatic
compilation error:
"none of the overloads of '__ctor' are callable using a mutable
object, candidates are: "
auto a=new immutable Info(1,"1");
How should I do if I would like to u
On Friday, 20 May 2016 at 16:09:54 UTC, chmike wrote:
But I now met another error in my main(). I can't assign the
immutable object to a mutable reference.
Info x1 = MyInfos.one;
Is it possible to define a mutable reference to an immutable
instance ?
Sort of possible with a library solutio
On Saturday, 21 May 2016 at 13:36:02 UTC, chmike wrote:
static Info one()
{
static auto x = Info(new Obj("I'm one"));
return x;
}
static Info two()
{
static auto x = Info(new Obj("I'm two"));
return x;
}
FYI those are thread local variable
On Saturday, 21 May 2016 at 10:42:13 UTC, chmike wrote:
switch(x1)
{
case Infos.one: writeln("case Infos.one"); break;
default: writeln("default"); break;
}
You can generate fairly unique ids and use them in switch
statements like this: https://dpaste.dzfl.pl/873b5b4cf71e
Probably normal, see this discussion:
https://forum.dlang.org/post/mailman.400.1389749305.15871.digitalmar...@puremagic.com
Anyway dmd is not known to have a quality backend, try ldc or gdc.
try this:
struct X
{
byte[] data;
alias data this;
}
On Thursday, 26 May 2016 at 21:13:14 UTC, Era Scarecrow wrote:
To do what I want currently it's something like...
enum Size = 1024, Other = 128;
Data[Size][Other] staticarray; //stack allocation
Data[][] sliced = staticarray[];
scan(sliced, condition);
void scan(ref Data[][] data, C
https://forum.dlang.org/post/kcr2vn$21i6$1...@digitalmars.com
implib can work for extern(C), but is likely to fail even for
them.
Another possibility is to use -m32mscoff switch
https://dlang.org/dmd-windows.html#switch-m32mscoff and use ms
toolchain for linking with PSDK import libraries.
On Friday, 27 May 2016 at 15:28:42 UTC, Andrew Edwards wrote:
Have you tried with extern(C) yet?
extern(C) is for undecorated symbold
extern(Windows) adds the _ and @12 decorations (would be
__stdcall on C/C++ side)
The thought never crossed my mind. Tried it and it works like a
charm. Thanks
Hmm... I wouldn't expect this to work, but still worth to report
in bugzilla.
On Friday, 27 May 2016 at 20:20:36 UTC, chmike wrote:
Is this code valid D or is the behavior undefined due to the
cast ?
A mutable object can be synchronized on:
synchronized(Category.instance){}
This will create and store a mutex in the object (sad but true,
design taken from java). If the i
On Saturday, 28 May 2016 at 05:30:26 UTC, chmike wrote:
Would it be different if the object was declared const instead
of immutable ?
Sometimes compiler is able to figure out that const data is
immutable.
This is a bit frustrating because it is trivial to implement in
C and C++.
For a tri
On Wednesday, 1 June 2016 at 07:29:56 UTC, abad wrote:
That does work, though I have to explicitly cast it in my
caller as well.
Like this:
doesNotLink(cast(const(char)**)baz2);
It's a bit troublesome as my code will include quite a lot of
calls like this.
Casting is not necessary with the
You can see how AutoImplement works for example
https://github.com/dlang/phobos/blob/master/std/typecons.d#L3269
Visual D has a tool to convert IDL files to D.
time_t is 64-bit on windows:
https://msdn.microsoft.com/en-us/library/1f4c8f33.aspx
On Friday, 17 June 2016 at 12:31:33 UTC, David Nadlinger wrote:
Structs cannot have a default constructor; .init is required to
be a valid state (unless you @disable default construction).
Except for nested structs :) They have the default constructor
and their .init is not a valid state: has
On Friday, 17 June 2016 at 13:21:04 UTC, Vladimir Panteleev wrote:
Windows does not have the concept of "time_t". The C runtime in
use does.
The D bindings don't copy that behavior.
D defining C runtime type different from C runtime causes this
error.
On Friday, 17 June 2016 at 16:25:15 UTC, Vladimir Panteleev wrote:
If I were to import the time() function from MSVCR*.dll, what
size its return value would be?
MSVC runtime dll doesn't export `time` function, it exports
_time32 and _time64. `time` is a wrapper in the import library,
its time
Store a wrapper instead of the actual function:
void wrapper(alias F)(string[] args)
{
(convert args to F arguments) and invoke
}
cmd.func = &wrapper!someFunc;
string[] args;
cmd.func(args);
Extract functions for shared parts:
void Do(string name)
{
DoStuff();
int i = find(name);
DoStuffWithIndex(i);
}
void Do(int name)
{
DoStuff();
DoStuffWithIndex(i);
}
On Tuesday, 12 July 2016 at 13:44:02 UTC, Adam Sansier wrote:
I don't like it, creates an extra function for no apparent
reason except to get around the problem of not having a yield
type of semantic. Again, I wasn't asking for any ol' solution,
there are many ways to skin this cat.
It's a no
On Tuesday, 12 July 2016 at 16:30:05 UTC, Adam Sansier wrote:
Doesn't matter, it's not what I asked.
Yeah, I'm not confident I understood your problem right. You can
try to describe your problem better.
On Wednesday, 13 July 2016 at 07:31:57 UTC, Adam Sansier wrote:
void** ptr = null;
auto res = CoCreateInstance(&CLS_ID, cast(IUnknown)null,
CLSCTX_INPROC_SERVER, &CLS_ID, cast(void**)&ptr);
See the example above.
IUnknown ptr = null;
auto res = CoCreateInstance(&MyCL
On Wednesday, 13 July 2016 at 16:48:53 UTC, Adam Sansier wrote:
There's a lot of misinformation on the net.
Nope, it's just you. COM support in D and in general works fine
for everyone else.
On Wednesday, 13 July 2016 at 21:27:29 UTC, Adam Sansier wrote:
Yes! your right, If you were only around to tell me that in the
first place! ;) Now we know. Again, as I said before, the
problem is informational.
We know it only after you posted links to threads with relevant
info. You knew th
On Wednesday, 13 July 2016 at 22:30:51 UTC, Adam Sansier wrote:
Um, no, I revived it so that people searching for answers
wouldn't be led astray by idiots who pretend to know everything.
My word is not COM specification of course, there's the official
documentation and tons of books about COM,
Use an intermediate class:
abstract class OtherObject1(S) : AbstractObject!S
{
abstract void Foo(int a, int b);
class OtherObject(S, bool R) : OtherObject1!S
{
int x;
override void Foo(int a, int b)
On Saturday, 16 July 2016 at 20:31:25 UTC, Adam Sansier wrote:
Yet you are wrong. Regardless what the asio standard does right
or wrong, it uses COM, correct? Is asio not well established?
Yes it is. Hence it proves that not all COM is as you think it
is.
The component must comply with the CO
On Saturday, 16 July 2016 at 21:16:29 UTC, Andrew Godfrey wrote:
COM is a model; in practice people pick the parts they need,
and often still call it "COM".
No need to rename what has a name:
https://en.wikipedia.org/wiki/Interface-based_programming
On Tuesday, 19 July 2016 at 12:30:49 UTC, celavek wrote:
final ulong[char] nucleotide_counts () const
{
return cached_counts;
}
BTW you can find enumap useful
https://forum.dlang.org/post/hloitwqnisvtgfoug...@forum.dlang.org
if you want to have small associative arrays wit
So you assert that variable length structs can't be allocated on
heap and sokoban example is a wrong example of variable length
struct usage?
And how heap indirection is different from stack indirection?
It's still indirection.
Well, cache locality can be optimized without reducing number of
indirections, as long as the data is likely to be in cache.
I agree with bearophile that variable size structs reduce number
of indirections and have no direct relation to cache locality.
One may have no time or no desire to initia
Well, it's proof of concept of bound checked variable-size
struct, I wrote it in a minute. It even compiles and runs.
On Wednesday, 16 April 2014 at 23:36:05 UTC, bearophile wrote:
Jeroen Bollen:
Is it possible to have a structure with a dynamic size?
See an usage example I have written here:
http://rosettacode.org/wiki/Sokoban#Faster_Version
This can illustrate
1. fairly straightforward translation of tru
Oh, and I don't believe, that a variable-size struct can be
emplaced inside fixed-size struct or class. Only as a smart
pointer from the example.
I mean, it doesn't cover all scenarios, but can be extended to
support them. The indexes array does just that: it's emplaced
without indirection, but still is bound checked.
On Friday, 18 April 2014 at 13:10:28 UTC, Steven Schveighoffer
wrote:
Note, you could probably, with mixin magic, make a version that
could be emplaced inside a struct or class without an extra
indirection.
Speaking about mixin magic, you probably suggest to do it overly
generically, though i
You should write and register a signal handler. Implementation
for x86-32 was posted here.
Fibers are more lightweight, they're not kernel objects. Threads
are scheduled by kernel (usually). Fibers are better if you can
get better resource usage with manual scheduling - less context
switches, or don't want to consume resources need by threads.
On Friday, 25 April 2014 at 19:06:33 UTC, brad clawsie wrote:
My code compiles and fails silently.
How do you want it to fail? C code doesn't throw exceptions.
Known bug https://issues.dlang.org/show_bug.cgi?id=2742
On Sunday, 11 May 2014 at 08:48:43 UTC, FreeSlave wrote:
On Sunday, 11 May 2014 at 07:43:07 UTC, Kagamin wrote:
Known bug https://issues.dlang.org/show_bug.cgi?id=2742
It's not bug. Write-functions are designed to output text to
stdout, and it's issue of programmer to make sure that expected
AFAIK, addRoot is for memory allocated in GC heap, and addRange
is for other types of memory, so you can't add non-gc memory as
root (just a guess, see docs). I would allocate whole Args in GC
heap and add is as root, yes, it would prevent collection until
the root is removed. A better way woul
You can write a tool, which will construct an amalgamation build
of your code.
Why many? I'd say, you typically have 0 subscriptions (label,
textbox) per widget, seldom - 1 (button, combobox, checkbox).
combobox and checkbox usually don't require a subscription
either. Only button requires a reaction from your code,
everything else usually works on its own.
Do you always bind all of them?
Another option is to allocate from pool.
It must be scanned, so you shouldn't specify NO_SCAN attribute,
it's for memory blocks, which are guaranteed to not hold pointers
to GC memory, like ubyte[] buffers for i/o, so managed blocks can
be safely collected without looking at content of NO_SCAN blocks.
On Tuesday, 13 May 2014 at 18:47:45 UTC, Gary Willoughby wrote:
They are not bound automatically but may be bound later.
So they will be allocated on demand - only if it's bound, Args
will be allocated, so widget will have only one Args allocated,
or as many as were actually bound. Or do you
On Tuesday, 13 May 2014 at 20:02:59 UTC, Tim Holzschuh via
Digitalmars-d-learn wrote:
Still: Would it be very difficult to write a suitable parser
from scratch?
See http://forum.dlang.org/post/lbnheh$2ssm$1...@digitalmars.com
with duscussion about parsers on reddit.
401 - 500 of 926 matches
Mail list logo