Re: free causes exception

2016-01-27 Thread Kagamin via Digitalmars-d-learn
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

Re: how to allocate class without gc?

2016-01-28 Thread Kagamin via Digitalmars-d-learn
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.

Re: Access Violation in @safe Code

2016-01-30 Thread Kagamin via Digitalmars-d-learn
Alias templates require stack pointer, init probably has it set to null. Try this: FooType foo = FooType();

Re: C Macro deeper meaning?

2016-02-01 Thread Kagamin via Digitalmars-d-learn
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.

Re: How would you implement this in D? (signals & slots)

2016-02-02 Thread Kagamin via Digitalmars-d-learn
http://dpaste.dzfl.pl/f888feb6f743

Re: print function

2016-02-04 Thread Kagamin via Digitalmars-d-learn
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

Re: What reasons are known a thread stops suddenly?

2016-02-05 Thread Kagamin via Digitalmars-d-learn
https://dlang.org/phobos/core_thread.html#.Thread.join

Re: What reasons are known a thread stops suddenly?

2016-02-05 Thread Kagamin via Digitalmars-d-learn
Yep, munching an Error by default is pretty nasty.

Re: Bug or intended?

2016-02-06 Thread Kagamin via Digitalmars-d-learn
I'd say support for this scenario is not implemented yet.

Re: Things that keep D from evolving?

2016-02-06 Thread Kagamin via Digitalmars-d-learn
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

Re: Dynamic Ctors ?

2016-02-08 Thread Kagamin via Digitalmars-d-learn
http://dpaste.dzfl.pl/1f25ac34c1ee You need Tuple, not Algebraic. Algebraic stores only one value of one type from a set, like Variant.

Re: why mkdir can't create tree of dirs?

2016-02-10 Thread Kagamin via Digitalmars-d-learn
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

Re: Example of code with manual memory management

2016-02-19 Thread Kagamin via Digitalmars-d-learn
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.

Re: Modify Function Pointer to Take Additional Parameters

2016-02-19 Thread Kagamin via Digitalmars-d-learn
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,

Re: What happens if memory allocation fails?

2016-02-20 Thread Kagamin via Digitalmars-d-learn
Currently it crashes: https://issues.dlang.org/show_bug.cgi?id=1180

Re: Curl HTTP segfault

2016-02-24 Thread Kagamin via Digitalmars-d-learn
http://pastebin.com/JfPtGTD8 ?

Re: Curl HTTP segfault

2016-02-24 Thread Kagamin via Digitalmars-d-learn
Oops, no, looks like you can't put HTTP in a class, because it works with GC and is ref counted.

Re: How to detect if an array if dynamic or static

2016-02-25 Thread Kagamin via Digitalmars-d-learn
void diss(int n)(ref int[n] array) { } But to consume array of any size, just take dynamic array as parameter.

Re: GStreamer and D

2016-02-26 Thread Kagamin via Digitalmars-d-learn
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

Re: Use of GUID constants

2016-03-11 Thread Kagamin via Digitalmars-d-learn
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

Re: Use of GUID constants

2016-03-11 Thread Kagamin via Digitalmars-d-learn
Oh, it was https://github.com/D-Programming-Language/druntime/pull/1472

Re: std.stdio.File.seek error

2016-03-14 Thread Kagamin via Digitalmars-d-learn
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

Re: Is there anybody who used FireBird DB?

2016-03-15 Thread Kagamin via Digitalmars-d-learn
The same as you would do it in C.

Re: Is there anybody who used FireBird DB?

2016-03-16 Thread Kagamin via Digitalmars-d-learn
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

Re: string and char[] in Phobos

2016-03-19 Thread Kagamin via Digitalmars-d-learn
When a string is not an in parameter, it can't be declared `in char[]`.

Re: Is there anybody who used FireBird DB?

2016-03-30 Thread Kagamin via Digitalmars-d-learn
Mingw or windows platform SDK.

Re: Is there anybody who used FireBird DB?

2016-03-30 Thread Kagamin via Digitalmars-d-learn
Also there's ODBC driver http://www.firebirdsql.org/en/devel-odbc-driver/ - you can use it, phobos has ODBC bindings.

Re: Is there anybody who used FireBird DB?

2016-03-30 Thread Kagamin via Digitalmars-d-learn
Latest version of what? ODBC bindings are in phobos: http://dlang.org/phobos/etc_c_odbc_sql.html

Re: Is there anybody who used FireBird DB?

2016-03-30 Thread Kagamin via Digitalmars-d-learn
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).

Re: Is there anybody who used FireBird DB?

2016-03-31 Thread Kagamin via Digitalmars-d-learn
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.

Re: Read only delegate

2016-04-04 Thread Kagamin via Digitalmars-d-learn
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.

Re: Convert wchar* to wstring?

2016-04-05 Thread Kagamin via Digitalmars-d-learn
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

Re: PostgreSQL. Unknown parameter of configuration : "autocommit"

2016-04-05 Thread Kagamin via Digitalmars-d-learn
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.

Re: How to set padding for base64 encoding

2016-04-07 Thread Kagamin via Digitalmars-d-learn
Create a range that would remove the newline characters from string, then decode from that.

Re: How to set padding for base64 encoding

2016-04-07 Thread Kagamin via Digitalmars-d-learn
chomp only trims the string at the beginning and at the end, not in the middle.

Re: mov reg,0 vs xor reg,reg in core.atomic ?

2016-04-11 Thread Kagamin via Digitalmars-d-learn
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

Re: Is there a way to disable 'dub test' for applications?

2016-04-18 Thread Kagamin via Digitalmars-d-learn
You can write it in code: version(unittest) static assert(false,"unit tests not supported");

Re: How do you use D to launch/open a window?

2016-04-23 Thread Kagamin via Digitalmars-d-learn
http://wiki.dlang.org/Libraries_and_Frameworks#GUI_Libraries

Re: C header file: tagged enumerations

2016-04-28 Thread Kagamin via Digitalmars-d-learn
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

Re: C header file: tagged enumerations

2016-04-29 Thread Kagamin via Digitalmars-d-learn
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

Re: Async or event library

2016-05-06 Thread Kagamin via Digitalmars-d-learn
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

Re: Async or event library

2016-05-06 Thread Kagamin via Digitalmars-d-learn
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

Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread Kagamin via Digitalmars-d-learn
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

Re: Async or event library

2016-05-17 Thread Kagamin via Digitalmars-d-learn
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?

Re: How to share an appender!string?

2016-05-19 Thread Kagamin via Digitalmars-d-learn
I'd say do something like https://dpaste.dzfl.pl/e9a2327ff2a1 Any idea why it crashes?

Re: Using -O with DMD seems to produce non-random values.

2016-05-19 Thread Kagamin via Digitalmars-d-learn
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;

Re: Use Requests to send data to webpage - how?

2016-05-20 Thread Kagamin via Digitalmars-d-learn
Does this work? Request rq = Request(); Response rs = rq.exec!"GET"("http://somewebpage.org/";, [parameter:data]);

Re: Immutable objects and constructor ?

2016-05-20 Thread Kagamin via Digitalmars-d-learn
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

Re: Immutable objects and constructor ?

2016-05-20 Thread Kagamin via Digitalmars-d-learn
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

Re: problems with Rebindable

2016-05-21 Thread Kagamin via Digitalmars-d-learn
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

Re: problems with Rebindable

2016-05-21 Thread Kagamin via Digitalmars-d-learn
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

Re: Problem with .debug info in program

2016-05-24 Thread Kagamin via Digitalmars-d-learn
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.

Re: Testing array ptr for offset 0...

2016-05-26 Thread Kagamin via Digitalmars-d-learn
try this: struct X { byte[] data; alias data this; }

Re: Testing array ptr for offset 0...

2016-05-27 Thread Kagamin via Digitalmars-d-learn
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

Re: Request assistance binding to Windows dsound.{lib, dll}

2016-05-27 Thread Kagamin via Digitalmars-d-learn
https://forum.dlang.org/post/kcr2vn$21i6$1...@digitalmars.com implib can work for extern(C), but is likely to fail even for them.

Re: Request assistance binding to Windows dsound.{lib, dll}

2016-05-27 Thread Kagamin via Digitalmars-d-learn
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.

Re: Request assistance binding to Windows dsound.{lib, dll}

2016-05-27 Thread Kagamin via Digitalmars-d-learn
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

Re: Alias this member shadowed by imported function identifier?

2016-05-27 Thread Kagamin via Digitalmars-d-learn
Hmm... I wouldn't expect this to work, but still worth to report in bugzilla.

Re: is my code to get CTFE instantiated object valid D ?

2016-05-27 Thread Kagamin via Digitalmars-d-learn
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

Re: is my code to get CTFE instantiated object valid D ?

2016-05-28 Thread Kagamin via Digitalmars-d-learn
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

Re: Calling C++ code with pointer** argument

2016-06-01 Thread Kagamin via Digitalmars-d-learn
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

Re: Derive interface from class?

2016-06-02 Thread Kagamin via Digitalmars-d-learn
You can see how AutoImplement works for example https://github.com/dlang/phobos/blob/master/std/typecons.d#L3269

Re: Accessing COM Objects

2016-06-14 Thread Kagamin via Digitalmars-d-learn
Visual D has a tool to convert IDL files to D.

Re: Different struct sizeof between linux and windows

2016-06-17 Thread Kagamin via Digitalmars-d-learn
time_t is 64-bit on windows: https://msdn.microsoft.com/en-us/library/1f4c8f33.aspx

Re: Default initialization of structs?

2016-06-17 Thread Kagamin via Digitalmars-d-learn
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

Re: Different struct sizeof between linux and windows

2016-06-17 Thread Kagamin via Digitalmars-d-learn
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.

Re: Different struct sizeof between linux and windows

2016-06-20 Thread Kagamin via Digitalmars-d-learn
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

Re: How can you call a stored function in an AA with proper number of arguments converted to the proper type?

2016-07-12 Thread Kagamin via Digitalmars-d-learn
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);

Re: Simple overloading without complications

2016-07-12 Thread Kagamin via Digitalmars-d-learn
Extract functions for shared parts: void Do(string name) { DoStuff(); int i = find(name); DoStuffWithIndex(i); } void Do(int name) { DoStuff(); DoStuffWithIndex(i); }

Re: Simple overloading without complications

2016-07-12 Thread Kagamin via Digitalmars-d-learn
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

Re: Simple overloading without complications

2016-07-12 Thread Kagamin via Digitalmars-d-learn
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.

Re: C++ interface vs D and com

2016-07-13 Thread Kagamin via Digitalmars-d-learn
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

Re: C++ interface vs D and com

2016-07-13 Thread Kagamin via Digitalmars-d-learn
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.

Re: C++ interface vs D and com

2016-07-14 Thread Kagamin via Digitalmars-d-learn
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

Re: Some asm help for the 'thiscall' calling convention?

2016-07-14 Thread Kagamin via Digitalmars-d-learn
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,

Re: How define such scheleton classes

2016-07-15 Thread Kagamin via Digitalmars-d-learn
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)

Re: Some asm help for the 'thiscall' calling convention?

2016-07-18 Thread Kagamin via Digitalmars-d-learn
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

Re: Some asm help for the 'thiscall' calling convention?

2016-07-18 Thread Kagamin via Digitalmars-d-learn
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

Re: returning constant references from class methods

2016-07-19 Thread Kagamin via Digitalmars-d-learn
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

Re: Dynamically Sized Structs

2014-04-17 Thread Kagamin via Digitalmars-d-learn
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.

Re: Dynamically Sized Structs

2014-04-17 Thread Kagamin via Digitalmars-d-learn
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

Re: Dynamically Sized Structs

2014-04-17 Thread Kagamin via Digitalmars-d-learn
Well, it's proof of concept of bound checked variable-size struct, I wrote it in a minute. It even compiles and runs.

Re: Dynamically Sized Structs

2014-04-17 Thread Kagamin via Digitalmars-d-learn
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

Re: Dynamically Sized Structs

2014-04-18 Thread Kagamin via Digitalmars-d-learn
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.

Re: Dynamically Sized Structs

2014-04-18 Thread Kagamin via Digitalmars-d-learn
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.

Re: Dynamically Sized Structs

2014-04-18 Thread Kagamin via Digitalmars-d-learn
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

Re: Throw exception on segmentation fault in GNU/Linux

2014-04-22 Thread Kagamin via Digitalmars-d-learn
You should write and register a signal handler. Implementation for x86-32 was posted here.

Re: On Concurrency

2014-04-25 Thread Kagamin via Digitalmars-d-learn
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.

Re: AES encryption with openssl bindings

2014-04-26 Thread Kagamin via Digitalmars-d-learn
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.

Re: Messy code in console

2014-05-11 Thread Kagamin via Digitalmars-d-learn
Known bug https://issues.dlang.org/show_bug.cgi?id=2742

Re: Messy code in console

2014-05-11 Thread Kagamin via Digitalmars-d-learn
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

Re: How to make sure GC allocated resources stay around when used in C functions?

2014-05-12 Thread Kagamin via Digitalmars-d-learn
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

Re: Templating everything? One module per function/struct/class/etc, grouped by package?

2014-05-12 Thread Kagamin via Digitalmars-d-learn
You can write a tool, which will construct an amalgamation build of your code.

Re: How to make sure GC allocated resources stay around when used in C functions?

2014-05-12 Thread Kagamin via Digitalmars-d-learn
Why many? I'd say, you typically have 0 subscriptions (label, textbox) per widget, seldom - 1 (button, combobox, checkbox).

Re: How to make sure GC allocated resources stay around when used in C functions?

2014-05-12 Thread Kagamin via Digitalmars-d-learn
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.

Re: How to make sure GC allocated resources stay around when used in C functions?

2014-05-12 Thread Kagamin via Digitalmars-d-learn
Do you always bind all of them?

Re: How to make sure GC allocated resources stay around when used in C functions?

2014-05-12 Thread Kagamin via Digitalmars-d-learn
Another option is to allocate from pool.

Re: How to make sure GC allocated resources stay around when used in C functions?

2014-05-14 Thread Kagamin via Digitalmars-d-learn
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.

Re: How to make sure GC allocated resources stay around when used in C functions?

2014-05-14 Thread Kagamin via Digitalmars-d-learn
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

Re: RegEx for a simple Lexer

2014-05-14 Thread Kagamin via Digitalmars-d-learn
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.

<    1   2   3   4   5   6   7   8   9   10   >