Re: Mistake of opening of a file having a name in cp1251.

2015-04-03 Thread Danny via Digitalmars-d-learn
According to the documentation https://msdn.microsoft.com/de-de/library/yeby3zcb.aspx, _wfopen already takes a wide-character string, not an ANSI string. So return _wfopen(name.tempCStringW(), mode.tempCStringW()); would be the correct way. All these weird ansi versions are Windows

Re: signal handling

2015-02-09 Thread Danny via Digitalmars-d-learn
Hmmm... Just found https://www.securecoding.cert.org/confluence/display/seccode/void+SIG33-C.+Do+not+recursively+invoke+the+raise%28%29+function, the bottom part Compliant Solution (POSIX) does raise() in the signal handler. However, I can't find it in the POSIX standard at

Re: internal compiler error with immutable

2015-02-08 Thread Danny via Digitalmars-d-learn
Hi Ketmar, Hi Ali, thank you! On Sunday, 8 February 2015 at 09:42:14 UTC, Ali Çehreli wrote: spawn(user, cucs, ubyte(3)); ^to! Other than that, it works. (The Attributes are basically literal constants but the library cannot know which are used in a given

internal compiler error with immutable

2015-02-07 Thread Danny via Digitalmars-d-learn
Hi, I'm trying to use immutable class instances and that seems to be really difficult. For example, with the following program I get an internal compiler error: cut- import std.outbuffer : OutBuffer; import std.typecons :

Re: signal handling

2015-02-07 Thread Danny via Digitalmars-d-learn
Hi rlonstein, I've now read up on the opengroup pages about signal handling (which references POSIX), and apparently it goes like this: A signal can be delivered to a specific thread or to a process. If it's delivered to a process, a random thread of that process will receive it. If it's

Re: internal compiler error with immutable

2015-02-07 Thread Danny via Digitalmars-d-learn
Hi, I've filed it with gdcproject.org before reading your reply. Will it be forwarded to issues.dlang.org or should I file it there as well? Also, it seems there's a new DMD release underway right now, does it still happen with that? (I tried but can't get it to build - doesn't seem to

signal handling

2015-02-06 Thread Danny via Digitalmars-d-learn
Hi, if I want to clean up inside a signal handler and then exit the process (as it would have without me handling it), what do I do? Can I exit() inside a signal handler or should I use a more direct quit now function? (after all, it could have been in the middle of relinking the free list

BitArray crash

2015-01-30 Thread Danny via Digitalmars-d-learn
Hi, I'm trying to use BitArray instead of rolling my own. But how does one use it? I tried: import std.bitmanip : BitArray; int main() { BitArray b; b[2] = true; return 0; } $ gdc l.d $ gdb a.out (gdb) r Program received signal SIGSEGV, Segmentation fault.

Threads and stdio and HANDLE

2015-01-28 Thread Danny via Digitalmars-d-learn
Hello, I'm trying to write some toy examples using threads in D. Is the std.stdio.File thread-local or shared? Is flockfile used when I synchronize on it? I tried checking phobos myself and found some things I don't get (in stdio.d): alias FLOCK = flockfile; this(this) { @trusted

Re: How to prevent sensitive information is displayed when the extension 'exe' is modified to 'txt' on windows?

2015-01-08 Thread Danny via Digitalmars-d-learn
Hi, sigh, so I have to annoy you with the truth... On Tuesday, 6 January 2015 at 17:15:28 UTC, FrankLike wrote: How to prevent sensitive information is displayed when the extension 'exe' is modified to 'txt' on windows? By not putting it in in the first place. Everything else is no good in

opDispatch

2014-12-25 Thread Danny via Digitalmars-d-learn
Hi, I'm trying to learn how opDispatch works. Unfortunately, a very simple example already doesn't work (error: no property 'a' for type 'Foo'): import std.stdio : writeln; struct X { int a; } class Foo { X value; template opDispatch(string s) {

Re: opDispatch

2014-12-25 Thread Danny via Digitalmars-d-learn
I tried to make it even simpler to get to the core of the problem I'm having: ... template opDispatch(string s) { alias value.a opDispatch; } The compiler then complains: error: need 'this' for 'a' of type 'int' I can only think: And? It's right there... it's a class instance,

Re: opDispatch

2014-12-25 Thread Danny via Digitalmars-d-learn
Tobias: Thanks! Your version works. But now it's read-only.

Re: opDispatch

2014-12-25 Thread Danny via Digitalmars-d-learn
Adam: Thanks, that was very illuminating! I tried and these work indeed. Is there a function like opDispatch which can be used (at compile time) to refer to something by name whether or not it's custom? (to access something like value.a safely. mixin and string concatenation looks like would

Re: opDispatch

2014-12-25 Thread Danny via Digitalmars-d-learn
Not sure how that works together with opDispatch. I am not sure why you see safety reasons at compile time though. Hmm, I'm not really worried about safety in this case (in many other slightly different scenarios I am). More worried about strange Unicode characters in fields I have no control