According to http://dlang.org/const3.html any modification of
immutable data causes undefined behaviour. Now I want to
initialise a struct with immutable members in some malloc'd
memory and found the emplace function. I came up with the
following code:
import core.stdc.stdlib;
import
On 2015-11-12 23:24, Justin Whear wrote:
I believe the purpose of the switch is to help folks who are trying to
write for bare or embedded systems by not emitting references to the D
runtime library and runtime module information. Whether it actually does
that in its current implementation is
this compiles and runs fine. Because emplace expects a typed
pointer, it actually modifies (*p).x and (*p).y
As far as I understand, this causes undefined behavior.
Are there any (safe) alternatives to this code other than
making the immutable members mutable?
As long as there are no other
On Sunday, 15 November 2015 at 11:12:02 UTC, Tobias Pankrath
wrote:
On Sunday, 15 November 2015 at 10:59:43 UTC, Tobias Pankrath
wrote:
Point* p = (allocate memory from somewhere);
emplace!Point(p, 1, 2);
immutable(Point)* immutableP = cast(immutable(Point)*) p;
You could also use the
On Sunday, 15 November 2015 at 10:59:43 UTC, Tobias Pankrath
wrote:
Point* p = (allocate memory from somewhere);
emplace!Point(p, 1, 2);
immutable(Point)* immutableP = cast(immutable(Point)*) p;
You could also use the emplace version that takes untyped memory:
Apparantly, the order in which parameters are passed to a
dynamically loaded C function is reversed. See the following
minimal example:
%> cat dll.c
#include "stdio.h"
int dll2(const char* first, const char* second) {
printf("dll2() - first: '%s', second: '%s'\n", first,
On Sunday, 15 November 2015 at 18:02:01 UTC, David Nies wrote:
On Sunday, 15 November 2015 at 18:00:09 UTC, David Nadlinger
wrote:
On Sunday, 15 November 2015 at 17:54:27 UTC, David Nies wrote:
How can I make sure the order is correct?
Whenever you use a C function, it must be marked as,
On Sunday, 15 November 2015 at 15:34:19 UTC, Jacob Carlborg wrote:
I'm pretty sure that the only things that are excluded are
module info and type info. It's still possible to use "new" and
all the array features that requires support in the runtime
(slicing, concatenation, appending and so
On 11/14/2015 07:53 AM, Alex wrote:
> 3. The only point I stumble on is, that the main feature in my program
> is, that the underlying array, to which my slices refer to never
> changes. So, I'm going to have more and more slices, which are going to
> be smaller and smaller and each points to
Hello,
Is there any IDE which allows debugging D apps on OSX?
I'm trying Mono-D, but getting error
"Debugger operation failed A syntax error in expression, near
'sizeof(void*)'"
GDB is installed using homebrew. Probably, something is wrong
with my gdb. When I'm trying to start debugging
On 16/11/15 7:45 PM, Vadim Lopatin wrote:
Hello,
Is there any IDE which allows debugging D apps on OSX?
I'm trying Mono-D, but getting error
"Debugger operation failed A syntax error in expression, near
'sizeof(void*)'"
GDB is installed using homebrew. Probably, something is wrong with my
On Sunday, 15 November 2015 at 18:00:09 UTC, David Nadlinger
wrote:
On Sunday, 15 November 2015 at 17:54:27 UTC, David Nies wrote:
How can I make sure the order is correct?
Whenever you use a C function, it must be marked as, even if
it's through a function pointer as in this case. Just
On Sunday, 15 November 2015 at 17:54:27 UTC, David Nies wrote:
How can I make sure the order is correct?
Whenever you use a C function, it must be marked as, even if it's
through a function pointer as in this case. Just apply the
attribute to the dll2_fn and dll3_fn declarations.
Hope this
On Sunday, 15 November 2015 at 18:12:52 UTC, David Nadlinger
wrote:
On Sunday, 15 November 2015 at 18:02:01 UTC, David Nies wrote:
How do I mark it as such? Can you please give an example?
Thanks for the quick reply! :)
Just add extern(C) to the beginning of the "alias" line.
— David
On Sunday, 15 November 2015 at 18:02:01 UTC, David Nies wrote:
How do I mark it as such? Can you please give an example?
Thanks for the quick reply! :)
Just add extern(C) to the beginning of the "alias" line.
— David
15 matches
Mail list logo