On Saturday, 1 October 2016 at 00:06:05 UTC, Matthias Klumpp
wrote:
I do none of those things in my code though...
`grep "~this" *.d` gives nothing? It can be a struct with
destructor stored in a class. Can you observe the error? Try to
set a breakpoint at onInvalidMemoryOperationError
On Sunday, 25 September 2016 at 16:23:11 UTC, Matthias Klumpp
wrote:
For Ubuntu, some modifications on the code were needed, and
apparently for them the code is currently crashing in the GC
collection thread: http://paste.debian.net/840490/
Oh, wait, what do you mean by crashing?
If it's heap corruption, GC has debugging option -debug=SENTINEL
- for buffer overrun checks. Also that particular stack trace
shows that object being destroyed is allocated in bin 512, i.e.
its size is between 256 and 512 bytes.
On Wednesday, 26 October 2016 at 10:03:30 UTC, dm wrote:
Why so strange default behavior do not kill other threads in
case some of threads raise exception?
But thanks anyway.
AFAIK, on posix you should join the child thread, and when you
do, the stored exception is rethrown in the joining
On Tuesday, 18 October 2016 at 18:18:16 UTC, Jason C. Wells wrote:
I'm not sure where LIB was set.
At least in vs2013 it's taken from registry somewhere
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft
SDKs\Windows\v8.1 (maybe v10 in your case).
https://github.com/dlang/dmd/pull/5500 maybe this
Can't find a function for it.
Yep, I need muldiv for long values on x86-64.
On Tuesday, 22 November 2016 at 13:29:47 UTC, RazvanN wrote:
Given the following code:
char[5] a = ['a', 'b', 'c', 'd', 'e'];
alias Range = char[];
writeln(is(ElementType!Range == char));
One would expect that the program will print true. In fact, it
prints false and I noticed that if
Maybe connect a service like https://twitter.com/StopForumSpam ?
Linux? Probably another bug.
Try this:
unittest
{
import core.exception : UnicodeException;
void f()
{
string ret;
int i = -1;
ret ~= i;
}
try
{
f();
}
catch(UnicodeException e)
{
assert(e.msg == "Invalid UTF-8
On Wednesday, 16 November 2016 at 22:43:55 UTC, lafoldes wrote:
Hi,
I'd like to create a UTF16 text file on Windows 7, using
std.stdio.File and std.stdio.File.write... functions (so no
binary write, no Win32 functions).
I was experimenting with variations of this code…:
import std.stdio;
static MySingleton get() {
if (instance_ is null) {
synchronized {
if (instance_ is null) {
atomicStore(instance_, new MySingleton);
}
}
}
return instance_;
}
This should work fine and faster.
On Thursday, 17 November 2016 at 17:18:27 UTC, Nordlöw wrote:
Why does D need both `@safe`, `@trusted` and `@system` when
Rust seems to get by with only safe (default) and `unsafe`?
Rust has 3 levels of safety: the code inside unsafe block is
@system, and the unsafe block as a whole is a
On Monday, 21 November 2016 at 11:22:40 UTC, ag0aep6g wrote:
Who could "someone" be? It's a self-contained example, and buf
doesn't leave the test function.
Anything in .data and .bss sections and stack. See
https://issues.dlang.org/show_bug.cgi?id=15723
As for GC compaction:
https://github.com/dlang/tools/commit/5ed4f176f41b7559c64cf525c07ccf13ca3a5160
this?
On the other hand if you do more IO, you can have higher CPU load
due to compression and serialization.
On Monday, 10 October 2016 at 07:12:10 UTC, Nordlöw wrote:
should not be scanned by the GC.
Shouldn't be a problem.
On Monday, 5 December 2016 at 20:25:00 UTC, Ilya Yaroshenko wrote:
Good D code should be nothrow, @nogc, and betterC. BetterC
means that it must not require DRuntime to link and to start.
Without runtime you won't have asserts (C has them), bounds
checking, array casts, string switch. Doesn't
On Friday, 16 December 2016 at 18:29:33 UTC, Ilya Yaroshenko
wrote:
Undefined symbols for architecture x86_64:
"__D14TypeInfo_Class6__vtblZ", referenced from:
__D8cppclass2Hw7__ClassZ in cppclass-7ed89bd.o
By using typeid you request the class' TypeInfo, and it pulls
quite a lot.
It looks more like a reference from C++ class TypeInfo to Class
TypeInfo vtable, which is legit since the C++ class TypeInfo is a
D class derived from Class TypeInfo. What's not good is a
reference to the C++ class TypeInfo in the first place.
On Thursday, 22 December 2016 at 09:01:21 UTC, Kagamin wrote:
It looks more like a reference from C++ class TypeInfo to Class
TypeInfo vtable, which is legit since the C++ class TypeInfo is
a D class derived from Class TypeInfo.
Or just an instance of Class TypeInfo, so its initializer needs
On Monday, 27 March 2017 at 21:02:05 UTC, Nierjerson wrote:
Anyone can help get this working? I think the issue maybe that
the interface pointer returned by the COM interface is "C-like"
and doesn't match what D expects an interface to be. I get
access violations when trying to call the
On Monday, 20 March 2017 at 15:46:10 UTC, Adam D. Ruppe wrote:
On Monday, 20 March 2017 at 15:38:26 UTC, Kagamin wrote:
This explicit slice won't work, because a slice of a fixed
size array results in a fixed size array.
No, it doesn't. int[4] a; typeof(a[] == int[])
You can try yourself in
A file stream would be another example of a thing that can't be
naturally const even if you opened it for reading.
On Monday, 20 March 2017 at 04:03:20 UTC, Vladimir Panteleev
wrote:
https://issues.dlang.org/show_bug.cgi?id=9279
Has it not been fixed?
That's specific to the return statement. Like you can assign an
address of a local variable, but you can't return it.
On Thursday, 16 March 2017 at 17:50:45 UTC, Adam D. Ruppe wrote:
string s = func()[]; // I'd allow it, at least the user wrote
`[]` meaning they realized it was stack data and presumably
knows what that means about the slice's lifetime
This explicit slice won't work, because a slice of a
Or if you want to completely abstract it:
https://forum.dlang.org/post/iqxkelatusfocfotp...@forum.dlang.org
Same as anywhere else. Integration test is a test that connects
to a deployed system, which is different from unittest only in
philosophical aspect.
On Wednesday, 5 April 2017 at 21:58:16 UTC, Inquie wrote:
What I am looking for is something like StringBuilder in C#.
If you want it to not copy data on expand, there's nothing like
that in D yet. I wrote one for myself :)
https://github.com/ikod/dlang-requests/blob/master/tests/app.d
On Thursday, 6 April 2017 at 13:49:11 UTC, Russel Winder wrote:
Is there any need for the unittest block in the application
created to run the integration tests?
If you don't care to call each and all of them by hand. Test
frameworks are handy for extensive testing, builtin unittests
work
https://issues.dlang.org/show_bug.cgi?id=15723
On Thursday, 20 April 2017 at 20:26:06 UTC, Nick Sabalausky
(Abscissa) wrote:
(even if it's from a C lib)
Same for D: .rdata is fine, but afaik you have only strings
there, the rest - .data, .bss, .tls will suffer the same issue.
Unique is probably not good for database connection: you then
can't have connection in two variables, also if it holds a
reference to GC-allocated memory, it can't be put to GC-allocated
memory, since when that GC-allocated memory is collected, Unique
will try to destroy its possibly already
RefCounted is ok
If GC methods it calls are legal during collection.
On Thursday, 2 March 2017 at 17:03:01 UTC, Kagamin wrote:
Functions working with strings usually assume valid utf and can
behave incorrectly on malformed utf.
Or rather they report an unrecoverable error terminating the
process.
On Thursday, 2 March 2017 at 16:20:30 UTC, SimonN wrote:
Should I always validate text from files manually with
std.utf.validate?
Or should I memorize which functions throw, then validate
manually whenever I call the non-throwing UTF functions? What
is the pattern behind what throws and what
On Sunday, 5 March 2017 at 20:54:06 UTC, XavierAP wrote:
What I want to learn (not debate) is the currently available
types, idioms etc. whenever one wants deterministic memory
management.
There's nothing like that of C++. Currently you have Unique,
RefCounted, scoped and individual people
People who don't use IDE, use printf debugging.
gdb wants dwarf debug info, windows uses codeview.
On Sunday, 30 July 2017 at 03:16:35 UTC, Mike wrote:
It appears `onStartTag` does not handle the root element.
Looks like a bug. Until the module is replaced, bug reports are
still accepted for it.
On Tuesday, 15 August 2017 at 15:19:02 UTC, Steven Schveighoffer
wrote:
However, I'm not sure about the postblit being called
afterward. Does a postblit need to be marked shared in order to
work for shared types?
Ideally yes, but it's difficult to come up with a good shared
postblit, send
On Tuesday, 15 August 2017 at 21:27:49 UTC, Arek wrote:
Yes, but this doesn't compile:
import std.stdio;
import std.concurrency;
struct A
{
int t;
int r;
int method() shared
{
return 0;
}
}
void consumer()
{
shared a =
https://github.com/dlang/phobos/blob/master/std/variant.d#L623
memcpy(, cast(const(void*)) , rhs.sizeof);
should be ok to cast unconditionally
On Wednesday, 16 August 2017 at 12:58:25 UTC, Steven
Schveighoffer wrote:
Use cases don't matter. What matters is: is it proper for
Variant to call the postblit (as it does currently) without
regard for the qualifiers?
Looks like it isn't, https://dpaste.dzfl.pl/183e6dae9867 - shared
On Monday, 14 August 2017 at 20:13:28 UTC, Arek wrote:
If I can ensure the uniqueness of the object, there is no need
to "share" it or synchronize the access.
You use manually managed multithreading, that's why you need
shared. And because compiler can't verify uniqueness, you are
requested
On Monday, 14 August 2017 at 22:22:58 UTC, Arek wrote:
I've found some simple workaround for this problem:
import std.stdio;
import std.concurrency;
struct Envelope(T) if (is(T == class)) // for simplicity of
this example, only classes
{
shared(T)[] obj;
this(shared T o)
Well, no wrapper is actually needed here:
class A
{
int method() shared;
}
void consumer()
{
shared a = receiveOnly!(shared A)();
}
void producer()
{
auto cons = spawn();
send(cons, new shared A());
}
On Wednesday, 16 August 2017 at 13:14:55 UTC, Steven
Schveighoffer wrote:
But that isn't a concern for Variant. It is only calling the
postblit, which does work.
Shouldn't it call destructor when it goes out of scope?
On Wednesday, 19 July 2017 at 15:28:50 UTC, Steven Schveighoffer
wrote:
I'm not so sure of that. Private functions still generate
symbols. I think in C, there is no symbol (at least in the
object file) for static functions or variables.
They generate hidden symbols. That's just how it
On Tuesday, 25 July 2017 at 02:48:57 UTC, NoBigDeal256 wrote:
What is the standard way of testing class templates in the
context of a library where some of the classes may never
actually be used by the library itself?
Write a test and instantiate whatever templates you want to test.
class
On Tuesday, 25 July 2017 at 15:56:45 UTC, Houdini wrote:
Yes, but it isn't the default way in C++ to do dynamic
instanciation.
https://github.com/isocpp/CppCoreGuidelines this? It's only 2
years old. The new operator predates it by decades.
On Monday, 24 July 2017 at 15:21:54 UTC, Houdini wrote:
D is very similar to C++ (and also grabs godd ideas from
Python), but I have a naive question : why does Walter Bright
chose to instanciate classes like in Java ?
C++ is big, there's always something you don't know about it.
Java
Try a newer compiler, this was fixed recently.
Report a bug.
They are for static data an thread-local storage.
On Sunday, 23 April 2017 at 20:33:48 UTC, Kevin Balbas wrote:
Is this the correct way to do it?
cast to shared, send to main thread, cast away shared?
Yes, as long as the thing is unique, you can cast it to shared or
immutable just fine.
On Friday, 4 August 2017 at 02:38:10 UTC, Andrew Edwards wrote:
OK, I was is indeed the problem. I was thinking for some reason
that s gets initialized inside nk_color_hex_rgb()
Usually C functions don't allocate memory. And when they do, they
do it in unique ways, which is a PITA, that's why
https://issues.dlang.org/show_bug.cgi?id=6585 is this fixed too?
How various opIndex will behave now?
On Wednesday, 16 August 2017 at 23:15:10 UTC, crimaniak wrote:
I wonder if it possible and usable to make some template to
support this pattern, where we give mutex(es), shared object(s)
and delegate to operate with objects as non-shared.
https://dpaste.dzfl.pl/8b3b05c8ec0a like this? Not
On Thursday, 22 June 2017 at 09:57:44 UTC, Andre Pany wrote:
This line raises the error:
TestStruct s2 = TestStruct(Reason.FU);
Error: cannot implicitly convert expression ("Fu") of type
Reason to InitialEnum!(Reason)
While this line is working fine:
TestStruct s1 = {reason: Reason.FU};
I
https://dpaste.dzfl.pl/74d67cfca3e8
I would guess indexOf returns a value suitable for indexing,
therefore it counts code units, while countUntil counts range
elements - code points in case of a string. Also number of code
points is not suitable for indexing an utf8 string, it can be
used to allocate a dstring, but not so much
On Saturday, 3 June 2017 at 06:19:29 UTC, Jonathan M Davis wrote:
Assigning Nullable!Test.init is equivalent to setting the
internal value to Test.init and setting _isNull to false.
Eh? Does it mean Nullable is default initialized to some non-null
default value?
On Sunday, 4 June 2017 at 08:51:44 UTC, Jonathan M Davis wrote:
On Saturday, 3 June 2017 at 06:19:29 UTC, Jonathan M Davis
wrote:
> Assigning Nullable!Test.init is equivalent to setting the
> internal value to Test.init and setting _isNull to false.
T _value;
bool _isNull = true;
So it was
On Tuesday, 13 June 2017 at 19:29:26 UTC, Gary Willoughby wrote:
Is it possible for the `result` variable in the following code
to be returned as an immutable type if it's created by adding
two immutable types?
Why do you even want that? Such plain data structure is
implicitly convertible to
You can try ldc and llvm intrinsics
http://llvm.org/docs/LangRef.html#alloca-instruction
http://llvm.org/docs/LangRef.html#llvm-stacksave-intrinsic
On Friday, 15 September 2017 at 04:01:13 UTC, Timothy Foster
wrote:
am I required to save the result of a C function to variable
before passing it into another function or?
No. You probably have stack corruption. Does it crash if
FMOD_System_Create returns ok?
It can't work this way. You can try std.variant.
Something like mixin("__traits(getProtection, A."~member~")")
On Wednesday, 6 September 2017 at 05:57:18 UTC, Psychological
Cleanup wrote:
I'm thinking that I might have to create an extra thread that
monitors for when a call needs to occur and does so.
Would work.
If your code doesn't conflict with GC, it's fine to work in an
unregistered thread.
You're not specific enough. What would be semantics of such
wrapper?
On Thursday, 31 August 2017 at 00:49:22 UTC, EntangledQuanta
wrote:
I've already implemented a half ass library solution.
It can be improved alot.
It's const(int delegate(char))
On Tuesday, 29 August 2017 at 04:41:34 UTC, graw-prog wrote:
< Content-Type: text/xml; charset="utf-8"
Should be
Content-Type: text/xml; charset=utf-8
You iterate over string literals:
https://dlang.org/spec/traits.html#allMembers
import std.conv;
auto ws=s.to!wstring;
On Tuesday, 29 August 2017 at 15:55:50 UTC, Adam D. Ruppe wrote:
http://dpldocs.info/experimental-docs/source/std.net.curl.d.html#L2470
Ow, annotated sources, cool.
pre {
box-sizing: border-box;
overflow: auto;
max-width: 800px; /* The script sets the real one */
Also
http://ithare.com/chapter-vb-modular-architecture-client-side-programming-languages-for-games-including-resilience-to-reverse-engineering-and-portability/ scroll to the part about language choice.
On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer
wrote:
On 12/15/17 10:08 AM, Kagamin wrote:
Maybe this https://issues.dlang.org/show_bug.cgi?id=18084
Thanks for looking into this. I created a PR to fix.
Szabo, can you please try with this patch and see if it fixes
your
On Sunday, 17 December 2017 at 13:36:15 UTC, Mike Parker wrote:
My limited testing on a 64-bit Linux VM shows no problems when
binding a C function as extern(C) or extern(Windows), and the
disassembly looks the same.
64-bit ABI fixed calling convention proliferation, only one cc is
used
Or this https://run.dlang.io/is/MO9Wiy
On Monday, 11 December 2017 at 23:33:44 UTC, Seb wrote:
---
void main(string[] args)
{
import std.conv, std.range, std.stdio;
foreach (d;
File(__FILE_FULL_PATH__).byChunk(4096).join.take(5)) {
writefln("%s", d.to!char);
}
}
---
A variant: https://run.dlang.io/is/2TUQBv
On Wednesday, 13 December 2017 at 21:38:49 UTC, Satoshi wrote:
What means this error and how to solve it?
object.d-mixin-1072(1112): Error: Global variable type does not
match previous declaration with same mangled name:
_D10TypeInfo_m6__initZ
Try to write typeinfo as is without mixin.
writeln(fileName);
if (!fileName.exists)
{
return;
}
:)
From https://gcc.godbolt.org/
__attribute__((stdcall))
int square(int num) {
return num * num;
}
_Z6squarei:
push ebp
mov ebp, esp
mov eax, DWORD PTR [ebp+8]
imul eax, DWORD PTR [ebp+8]
pop ebp
ret 4
https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/x86-Function-Attributes.html#index-functions-that-pop-the-argument-stack-on-x86-32-3
looks like gcc doesn't see it as OS dependent.
On Monday, 18 December 2017 at 10:08:13 UTC, Andrey wrote:
Is core.sys.windows.windows equals fully to C WinApi, do you
know?
Should be enough for most things.
You said tests fail?
class SourceResult
{
private const
{
string file;
size_t line;
}
this(string fileName = __FILE__, size_t line = __LINE__, size_t
range = 6) nothrow
{
this.file = fileName;
You can also try to call `exists` somewhere before this part of
code.
Try printf debugging in case argument is invalid.
Maybe this https://issues.dlang.org/show_bug.cgi?id=18084
That said, tempCString code is suspicious:
https://github.com/dlang/phobos/blob/master/std/internal/cstring.d#L221
If unittest-versioned exists calls release-versioned tempCString,
it will corrupt the stack. Try to replace 16 with 256 there and
recompile your code.
And https://github.com/Extrawurst/DerelictFmod/issues/1
On Thursday, 2 November 2017 at 14:22:56 UTC, Guillaume Piolat
wrote:
Question 1. Is it mandatory to inherit from
core.sys.windows.unknwn.IUnknown, or just having an interface
named "IUnknown" validate it for being a COM interface?
If yes, then how am I supposed to use COM interfaces in
On Friday, 8 December 2017 at 07:34:53 UTC, Arun Chandrasekaran
wrote:
I was wondering if std.container.array.Array supports
threadsafe parallel reads similar to std::vector.
No, your code can also fail on a system with inconsistent cache
because data written by writing thread can remain in
Other functions that can be used for this are
GetFileInformationByHandle, GetFileSizeEx, SetFilePointerEx or
File.size in phobos.
On Wednesday, 29 November 2017 at 16:13:13 UTC, Wanderer wrote:
static void getId(shared IdGen!(MyId)* g)
{
writeln("next: ", g.next());
writeln("next: ", g.next());
}
writeln synchronizes on stdout, so your code is mostly
serialized, good example of a very subtle race condition.
A lock on stdout works as a barrier: threads may hit it
simultaneously, but pass it one by one in a queue with a time gap
between them.
501 - 600 of 898 matches
Mail list logo