On Friday, 9 December 2016 at 20:35:07 UTC, Ali Çehreli wrote:
Assuming boundschecking is turned off, I think you get unlucky
in the mini program and happen to hit a '\0' byte.
No, no.. the program built in debug mode with dub.
On Friday, 9 December 2016 at 21:20:12 UTC, Martin Krejcirik
wrote:
On Friday, 9 December 2016 at 16:50:05 UTC, unDEFER wrote:
And in mini program it works and shows diagnostic message.
Where my diagnostic message in more complicate program???
Try redirecting stdout and stderr to a file(s).
On Saturday, 10 December 2016 at 01:30:52 UTC, Jonathan M Davis
wrote:
On Saturday, December 10, 2016 01:19:45 unDEFER via
Digitalmars-d-learn wrote:
Well, much as I'd love to rag on Windows for doing dumb and
annoying stuff with file locks (which they do do), in this
case, your code
Hello!
$ cat try.d
import std.file;
void main ()
{
mkdir("D:\\TEST");
remove("D:\\TEST");
}
$ ./try.exe
std.file.FileException@std\file.d(731): D:\TEST: Access Denied.
What I don't know about removing directories in Windows?
Why I can't remove directory
On Saturday, 10 December 2016 at 01:28:13 UTC, SonicFreak94 wrote:
On Saturday, 10 December 2016 at 01:19:45 UTC, unDEFER wrote:
remove("D:\\TEST");
Try rmdir instead.
But it works under Linux
On Saturday, 10 December 2016 at 03:36:11 UTC, Adam D. Ruppe
wrote:
On Saturday, 10 December 2016 at 03:29:18 UTC, unDEFER wrote:
But it works under Linux
That's just because the underlying C function handles the case.
But the D function makes no promises about that:
std.file.remove's
On Friday, 9 December 2016 at 09:29:36 UTC, rikki cattermole
wrote:
On 09/12/2016 10:26 PM, unDEFER wrote:
An exception/error might be thrown, try catching Error's in the
threads function.
Also try adding an infinite loop to it.
Exceptions works good, and prints debug message always. It is
On Friday, 9 December 2016 at 09:42:52 UTC, unDEFER wrote:
Exceptions works good, and prints debug message always. It is
not exception..
I have tried to add try/catch around full loop of the program.
It doesn't work. And program has infinite loop.
But maybe it is unhandled signal?
I have
Hello!
I'm starting port my program to Windows _without_ Cygwin and
found big trouble.
My main thread exits unexpectedly without any diagnostic
messages. The second thread still lives when it happens.
The visual studio debugger say that thread exits with code 2.
What it maybe?
On Saturday, 10 December 2016 at 18:30:53 UTC, Adam D. Ruppe
wrote:
On Saturday, 10 December 2016 at 18:09:43 UTC, unDEFER wrote:
I know, but why it works in Linux by Linux documentation?
Coincidence. That detail is undefined in the D documentation
which means the implementation is free to
On Saturday, 10 December 2016 at 14:10:15 UTC, ag0aep6g wrote:
On 12/10/2016 04:39 AM, unDEFER wrote:
man remove:
remove - remove a file or directory
That's documentation for C, not for D.
I know, but why it works in Linux by Linux documentation?
On Friday, 9 December 2016 at 10:08:24 UTC, unDEFER wrote:
On Friday, 9 December 2016 at 09:42:52 UTC, unDEFER wrote:
Exceptions works good, and prints debug message always. It is
not exception..
I have tried to add try/catch around full loop of the program.
It doesn't work. And program has
On Friday, 9 December 2016 at 14:29:38 UTC, unDEFER wrote:
I'm afraid that the problem that my program wants to say
something, but there is no "flush" so message leaves in the
buffer.
I have found, it was code like:
string path = "C:";
string parent = path[0..path.lastIndexOf("\\")];
And in
I'm afraid that the problem that my program wants to say
something, but there is no "flush" so message leaves in the
buffer.
Hello!
Simple using of delegates:
===
#!/usr/bin/rdmd
import std.stdio;
void main()
{
void delegate() functions[];
foreach (i; 0..10)
{
void print()
{
writefln("%s", i);
}
functions ~=
}
foreach (i; 0..10)
{
Yes, I have found:
=
#!/usr/bin/rdmd
import std.stdio;
void main()
{
void delegate() functions[];
foreach (i; 0..10)
{
auto get_print(int i)
{
void print()
{
writefln("%s", i);
}
On Thursday, 1 December 2016 at 20:12:15 UTC, Ali Çehreli wrote:
First, the scary syntax that produces a lambda from an int:
...
Better:
...
All methods.. Thank you!
Hello, dub makes string like the next to compile my program
(WS_32.LIB at the beginning):
$ dmd -m32mscoff -lib
-of.dub\\build\\library-debug-windows-x86-dmd_2072-83D2723917096513EB360761C22DDD87\\db.lib -debug -g -w -version=Have_bdb2d WS_32.LIB libdb53d.lib source/berkeleydb/* -vcolumns
On Monday, 5 December 2016 at 07:21:30 UTC, Jacob Carlborg wrote:
If you compile your D code with the "-m32mscoff" flag it will
produce COFF objects and use the Visual Studio tool chain
(linker and runtime). Compiling for 64bit (-m64) will always
produce COFF objects.
Big thanks! -m32mscoff
OK, I have found. It must be library WS2_32.LIB from Microsoft
SDK. But dumpbin doesn't show __imp__htonl@4 symbol there. The
magic!
Thank you!
Hello! I have compiled libdb (BerkeleyDB) with Microsoft Visual
Studio 2015.
1) "Debug" mode. I have libdb53d.dll file. Do implib.
The linker doesn't seen symbols from the library! Do "lib -l". In
the list of symbols "db_create", linker searches "_db_create". Is
it the problem?
2)
On Monday, 5 December 2016 at 11:51:52 UTC, unDEFER wrote:
"libs-posix": ["db"],
"sourceFiles-windows-dmd": ["libdb53d.lib", "WS_32.LIB"],
"dflags-windows": ["-m32mscoff"],
"subPackages": [
I understand that I don't must add "sourceFiles-windows-dmd" to
lib project, I
On Monday, 5 December 2016 at 15:16:27 UTC, unDEFER wrote:
2) Its put to linker command at the first "libdb53d.lib
WS2_32.lib" and AFTER that -m32mscoff. As result "cannot open
file".
Oh, the reason was mistype. And I have found how-to hide linker
warning ("lflags-windows":
On Monday, 5 December 2016 at 14:59:26 UTC, Mike Parker wrote:
"libs-windows-dmd":["libdb53d.lib","ws2_32.lib"]
I have used "sourceFiles-windows-dmd", because it is the single
that I could find.
Thank you, "libs-windows-dmd":["libdb53d","WS2_32"] works much
better, but again these errors:
Hello, there!
I have the next "grep" code:
https://dpaste.dzfl.pl/7b7273f96ab2
And I have the directory to run it:
$ time /home/undefer/MyFiles/Projects/TEST/D/grep "HELLO" .
./strace.log: [pid 18365] write(1, "HELLO\n", 6HELLO
real1m17.096s
user0m54.828s
sys 0m13.340s
The same
On Sunday, 16 July 2017 at 17:37:34 UTC, Jon Degenhardt wrote:
On Sunday, 16 July 2017 at 17:03:27 UTC, unDEFER wrote:
[snip]
How to write in D grep not slower than GNU grep?
GNU grep is pretty fast, it's tough to beat it reading one line
at a time. That's because it can play a bit of a
I understand the main problem. dirEntries by default follows
symlinks.
Without it my first grep works only 28.338s. That really cool!
What the God? I was not ready to post...
File file;
try {
file = File(path);
}
catch (Exception exp)
{
return;
}
try {
//Some actions with file
}
catch (ErrnoException)
{
return;
}
catch (ErrnoException) is necessary
Hello! I have the code like this:
File file;
try {
file = File(path);
}
catch (Exception exp)
{
return;
}
...
try {
}
On Thursday, 13 July 2017 at 08:53:24 UTC, Moritz Maxeiner wrote:
Where does that `File` come from? If it's std.stdio.File, that
one is a struct with internal reference counting, so it
shouldn't crash in the above. Could you provide a minimal
working (in this case crashing) example?
Yes File
Thank you. I will write if will find the reason of description
corruption.
Seems I have found. I must do:
try{
File file;
try {
file = File(path);
}
catch (Exception exp)
{
return;
}
//Some actions with file
}
catch (ErrnoException)
{
return;
}
On Tuesday, 25 July 2017 at 10:24:13 UTC, Andrea Fontana wrote:
On Tuesday, 25 July 2017 at 10:23:33 UTC, Andrea Fontana wrote:
On Tuesday, 25 July 2017 at 10:06:47 UTC, unDEFER wrote:
Any ideas?
I think you should use/contribute to DCD project
https://github.com/dlang-community/DCC
Andrea
On Tuesday, 25 July 2017 at 10:35:14 UTC, Andrea Fontana wrote:
If you want to add UFCS suggestions to DCD it would be useful
for your project and all other IDEs too!
Andrea
Thank you, I will think. But if it was easy, authors self would
do it :-)
Hello!
I have written my text editor with highlighting, and now I want
to add IDE features to it.
I want to make autocompletion, but not only complete members of
class/struct, but also all functions which maybe used with type,
if the first argument of the function is this type. I.e. in
On Tuesday, 25 July 2017 at 10:42:40 UTC, Basile B. wrote:
I think that you underestimate the amount of work needed and
your solution which is to use the compiler with -o- looks bad.
What you really need is a compiler front-end which is basically
what libdparse + DSymbol are. DCD uses them.
I have found the answer in the code.
Right code is:
Import imp = m.isImport();
if (imp !is null)
Thank you.
Hello!
I'm hacking dmd compiler and trying to look on members array just
after parse module.
for(uint i = 0; i < members.dim; i++)
{
Dsymbol m = (*members)[i];
// It is good, but further:
Import imp = cast(Import) m;
if (imp !is null)
{
printf(" import %s.%s\n",
Hello! I'm trying to do some strange thing: compile some
Statement (do semantic3 phase) in the scope of other function.
Other function is for example:
auto megafunction()
{
B b;
uint a = 25;
return b;
}
AST of this code looks like:
FuncDeclaration
{
fbody = CompoundStatement
On Thursday, 27 July 2017 at 11:59:51 UTC, unDEFER wrote:
So how to get scope e.g. after line "B b;"?
I have found. That in scopes was found symbols from declarations,
you must iterate by declarations (DeclarationExp) and add symbols
by sc.insert(decexp.declaration);
On Wednesday, 26 July 2017 at 06:50:21 UTC, Jacob Carlborg wrote:
For Expression, there's a field called "op" that indicates what
kind of expression it is, which can used in combination with a
cast.
Thank you for hint!
On Wednesday, 26 July 2017 at 07:41:20 UTC, Andrea Fontana wrote:
Did you try with [1]?
[1] http://forum.dlang.org/post/okktlu$2bin$1...@digitalmars.com
Thank you, interesting. But I'm afraid it is not enough.
Hello, I have the next code (minimized with DustMite):
struct Tup(T...)
{
bool opEquals() {
foreach (i; T)
static if (__traits(compiles, mixin("new
InputRangeObject11261!(abs_class)")))
msg;
}
}
/**/
void test3()
{
On Tuesday, 18 December 2018 at 15:54:28 UTC, Seb wrote:
On Tuesday, 18 December 2018 at 14:35:46 UTC, unDEFER wrote:
What I could build wrong and how to build dmd properly?
Maybe you built dmd.d with debug assertions? (ENABLE_DEBUG=1)
You can build dmd with the `./build.d` script or `make
On Tuesday, 18 December 2018 at 16:19:33 UTC, unDEFER wrote:
Yes, thank you for the hint. You are almost right. I did not
ENABLE_DEBUG=1, but I also did not ENABLE_RELEASE=1
So it is the bug. I will report about it.
https://issues.dlang.org/show_bug.cgi?id=19500
So in digging by this problem, I have made simple patch to
druntime. I have added in druntime/src/core/thread.d to
final Thread start() nothrow
of class Thread
import core.stdc.stdio;
printf("start Thread\n");
And to
~this() nothrow @nogc
import core.stdc.stdio;
So more digging..
dtor of Thread calls in GC.collect() if thread is finished.
But it's do nothing because
bool not_registered = !next && !prev && (sm_tbeg !is this);
is always true... So how to register the thread?
Hello!
I have the program which uses BDB and while testing often makes
spawn. And after 12 hours of testing bdb said:
mmap: Cannot allocate memory
But the problem that I've found that it is not BDB created too
many maps. Watching for /proc/[PID]/maps shows that number of
anonymous mapped
So it looks like a bug, and I have reported about it:
https://issues.dlang.org/show_bug.cgi?id=19487
On Thursday, 29 November 2018 at 14:51:40 UTC, Steven
Schveighoffer wrote:
You need to compile druntime in debug mode. One thing you can
do is implement the function locally, and then break on it
(it's a C linkage, so I think the linker will grab your copy
instead of the one in druntime)
No I'm not preallocating any exceptions. It was idea, but I
removed all calls which can make throw.
I'm using very old dmd 2.074.1, so as I have patched it for my
text editor with IDE functions. I had a year break in
development, so now I need to rewrite all my patches.
But exactly the output
Hello! After long-long time of debugging, I just have decided
InvalidMemoryOperationError in my program. But now my program
after few hours of testing again crashes with "Finalization
error".
What this error means exactly? I again did something wrong in
destructor?
And how to debug it? I
Hello, as I know allMembers returns members not recursively. If
you want to get really all members you need to make recursive
function. In my program I used the next routine to print all
members of module:
static void allMembersOfModule(string module_name, bool
root=false)()
{
static if
It is easy. You can make both types as children of common parent
class myT, and when return myT.
54 matches
Mail list logo