On Friday, 12 January 2018 at 05:24:52 UTC, Venkat wrote:
I get a SegFault with the main method below which uses
HibernateD . The second main method which uses ddbc just works
fine. What is wrong with the first main method ? I have
attached the error at the bottom although I don't think it says
On Thursday, 11 January 2018 at 21:30:43 UTC, aliak wrote:
On Thursday, 11 January 2018 at 08:56:11 UTC, ChangLong wrote:
When I try add some sub type for struct with mixin template,
seems there is no way to hidden the private type.
Is there a way to hidden type from mix template like Voldemor
I get a SegFault with the main method below which uses HibernateD
. The second main method which uses ddbc just works fine. What is
wrong with the first main method ? I have attached the error at
the bottom although I don't think it says much.
This method uses HibernateD
int main() {
On Thursday, January 11, 2018 14:07:18 Ali Çehreli via Digitalmars-d-learn
wrote:
> On 01/11/2018 12:21 PM, Marc wrote:
> > I stuck at this and can't figure out the reason why the value of the
> > variable ds is 0 when I do this: startTime = MonoTime.currTime;
>
> It's not clear which of the two
Is there a way to make __gshared part of an alias?
as in
enum AddrSpace : uint
{
Private = 0,
Global = 1,
Shared = 2,
Constant = 3,
Generic = 4,
}
struct Variable(AddrSpace as, T)
{
T val;
alias val this;
}
alias Global(T) = __gshared Variable!(AddrSpace.Glob
//
// rdmd -m64 foo.d
//
module va_arg_x64_windows;
void foo(void* a, void* b, void *c, void* d, ...) {
import core.vararg : va_arg;
import std.stdio : writeln;
foreach (arg; _arguments) {
if (arg == typeid(int)) {
int x = va_arg!(int)(_argptr);
writel
On Thursday, 11 January 2018 at 17:02:58 UTC, Amorphorious wrote:
Looking for something similar. I simply need to show the video
of a camera and be able to do to basics like rotation, crop,
etc.
On which platform? On Windows I've successfully used DirectShow,
I can show an example of working
On Friday, 12 January 2018 at 03:21:15 UTC, Sebastian Trent wrote:
I'm writing an operating system in D for some exotic hardware.
I understand the D runtime environment depends on a C stdlib
being available (at compile time or run time?)
both
As a consequence of the hardware, I need to use ou
Hello,
I'm writing an operating system in D for some exotic hardware. I
understand the D runtime environment depends on a C stdlib being
available (at compile time or run time?)
As a consequence of the hardware, I need to use our own C std lib
for the operating system. How can I set about di
On Friday, 12 January 2018 at 00:54:03 UTC, kdevel wrote:
$ dmd crash.d
$ ./crash
Nicholas Wilson is right that you can use = "" to work around it,
but with strings, null is supposed to behave the same way.
And this gives different (each wrong) behavior on -m32 vs -m64,
which leads me to be
On 01/12/2018 02:45 AM, Nicholas Wilson wrote:
because you don't initialise `s` in
string toString ()
{
string s;
return s;
}
so it defaults to `string s = null;` thus giving a segfault.
try `string s = "";` instead.
A null string is a perfectly fine empty string. Prin
On Friday, 12 January 2018 at 01:45:37 UTC, Nicholas Wilson wrote:
so it defaults to `string s = null;` thus giving a segfault.
null and "" are basically the same for strings. that's not the
problem.
On Monday, 8 January 2018 at 23:31:27 UTC, Jonathan M Davis wrote:
auto foo(T)(auto ref T t)
{
return t;
}
foo(42);
will result in foo being instantiated as
int foo(int t)
{
return t;
}
whereas
int i;
foo(i);
will result in foo being instantiated as
int foo(ref int t)
{
retur
On Friday, 12 January 2018 at 00:54:03 UTC, kdevel wrote:
crash.d
```
import std.stdio;
union U {
float f;
int i;
string toString ()
{
string s;
return s;
}
}
void main ()
{
U u;
writeln (u);
}
```
$ dmd crash.d
$ ./crash
because you don't initialise `s` in
crash.d
```
import std.stdio;
union U {
float f;
int i;
string toString ()
{
string s;
return s;
}
}
void main ()
{
U u;
writeln (u);
}
```
$ dmd crash.d
$ ./crash
std.exception.ErrnoException@/.../dmd2/linux/bin64/../../src/phobos/std/stdio.d(2776):
(Bad add
Hi, so basically is there a way to:
void func(alias pred = null, Range)(Range range) {
// 1) check if pred(ElementType!Range.init,
ElementType!Range.init) is equality
// 2) check if isUnary!pred
// 3) check if isBinary!pred
}
I think maybe the isUnary or isBinary may not work unless it
On Thursday, 11 January 2018 at 23:20:44 UTC, WhatMeWorry wrote:
When I simply move the array out of main() but still in app.d,
the compiler returns
Error: expression ["SCRATCH":Track("scratch.wav", cast(Sound)1,
0, null),... is not a constant.
Can I use "static if" or "static this()", or "mi
I've built a sound.d module with lots data types, free functions
(initAndOpenSound() loadSound()), and enums etc.
In my main/app.d module, I've created the the following
associative array:
void main(string[] argv)
{
initAndOpenSound();
Track[string] tracks =
[
"SCRATCH"
On 01/11/2018 12:21 PM, Marc wrote:
> I stuck at this and can't figure out the reason why the value of the
> variable ds is 0 when I do this: startTime = MonoTime.currTime;
It's not clear which of the two statements you're talking about.
>> http.onProgress = (size_t dltotal, size_t dlnow,
>>
On Thursday, 11 January 2018 at 21:09:01 UTC, Nordlöw wrote:
Is there no equivalent of `calloc()` for
`std.experimental.allocator`, something like
Allocator.zeroAllocate(size_t numberOfElements)
?
http://dpldocs.info/experimental-docs/std.experimental.allocator.makeArray.4.html
On Thursday, 11 January 2018 at 08:56:11 UTC, ChangLong wrote:
When I try add some sub type for struct with mixin template,
seems there is no way to hidden the private type.
Is there a way to hidden type from mix template like Voldemort
type ?
fake code:
mix template TypeX () {
alias Th
Is there no equivalent of `calloc()` for
`std.experimental.allocator`, something like
Allocator.zeroAllocate(size_t numberOfElements)
?
On 1/11/18 3:21 PM, Marc wrote:
I stuck at this and can't figure out the reason why the value of the
variable ds is 0 when I do this: startTime = MonoTime.currTime; if I
remove that statement, the value of ds isn't zeroed, it has the actual
number of seconds. But I can't figure out, ds is of in
I stuck at this and can't figure out the reason why the value of
the variable ds is 0 when I do this: startTime =
MonoTime.currTime; if I remove that statement, the value of ds
isn't zeroed, it has the actual number of seconds. But I can't
figure out, ds is of integer type and such, it is copie
On 1/11/18 12:41 PM, tipdbmp wrote:
Appender is able to do this:
It seems that Appender allocates its own private data:
private struct Data
{
size_t capacity;
Unqual!T[] arr;
bool canExtend = false;
}
private Data* _data;
_data = new Data;
But hopefully its bug free u
Appender is able to do this:
It seems that Appender allocates its own private data:
private struct Data
{
size_t capacity;
Unqual!T[] arr;
bool canExtend = false;
}
...
private Data* _data;
...
_data = new Data;
But hopefully its bug free unlike what I posted (missing
`T.sizeof *`
On Thursday, 11 January 2018 at 14:59:18 UTC, DanielG wrote:
Ah, thank you! I replaced:
"libs-windows-x86-dmd"
with:
"sourceFiles-windows-x86-dmd" (and added a .lib suffix)
and now everything works as expected.
I see now that I was using "libs" improperly. It seems more for
system-
On 1/11/18 6:21 AM, tipdbmp wrote:
string push_stuff(char[] buf, int x) {
if (x == 1) {
buf ~= 'A';
buf ~= 'B';
buf ~= 'C';
return cast(string) buf[0 .. 3];
}
else {
buf ~= 'A';
buf ~= 'B';
return cast(string) buf[0 ..
On Wednesday, 10 January 2018 at 23:08:28 UTC, Luís Marques wrote:
void main()
{
int[]* x = &[[1, 2, 3]][0];
int[]* x2 = [[1, 2, 3]].ptr; /* same */
}
That's an interesting solution. I'm not sure which one I
prefer, the wrapper or this one. Still... I feel like the
language should just
On Tuesday, 30 September 2014 at 03:41:20 UTC, Kyle wrote:
Hi,
Has anyone successfully used D to capture images from a webcam?
Something like what you can do with OpenCV or pygame's camera
API? Any idea how I can do this without having to know a lot of
complex stuff? Thanks!
Looking for som
On Thursday, 11 January 2018 at 13:18:47 UTC, Simen Kjærås wrote:
On Thursday, 11 January 2018 at 12:32:54 UTC, Per Nordlöw wrote:
Is this an ok implementation:
enum bool isNogc(alias fun) = (isCallable!fun &&
(functionAttributes!fun &
Ah, thank you! I replaced:
"libs-windows-x86-dmd"
with:
"sourceFiles-windows-x86-dmd" (and added a .lib suffix)
and now everything works as expected.
I see now that I was using "libs" improperly. It seems more for
system-wide libraries / things in the library search path, not to
be
On Thursday, 11 January 2018 at 14:22:50 UTC, DanielG wrote:
If I manually override "libs-windows-x86-dmd" in the example's
dub.json, it links despite the error, but if possible I would
like users of my library to not have to concern themselves with
linkage issues.
vibe.d seems to do it suc
Thank you very much, very helpful!
I'm currently attempting the (A) suggestion, but find that dub
isn't fixing up the relative path to one of the parent's
prerequisite libraries.
In the parent:
"libs-windows-x86-dmd": ["./lib/32/dmd/SomeLibrary"]
This causes a warning when building the n
Have you checked what push_stuff actually returns with those
inputs?
Right, we get [0xFF, 0xFF, 'A'] and [0xFF, 0xFF].
I think the following is a pretty easy workaround though:
alias usize = size_t;
struct Push_Buf(T, usize stack_size) {
T[stack_size] stack_buf;
T[] heap_buf;
usize
On Thursday, 11 January 2018 at 12:32:54 UTC, Per Nordlöw wrote:
Is this an ok implementation:
enum bool isNogc(alias fun) = (isCallable!fun &&
(functionAttributes!fun &
FunctionAttribute.nogc));
@safe pure nothrow @nogc unittest
{
On Thursday, 11 January 2018 at 12:27:27 UTC, DanielG wrote:
Is there a simple example that shows how to test the library
during development, before publishing (ie, before being able to
add it as a dependency to another project)?
I guess I'm just asking, what's the convention here? Do I
creat
On Thursday, January 11, 2018 11:21:08 tipdbmp via Digitalmars-d-learn
wrote:
> string push_stuff(char[] buf, int x) {
> if (x == 1) {
> buf ~= 'A';
> buf ~= 'B';
> buf ~= 'C';
> return cast(string) buf[0 .. 3];
> }
> else {
> buf ~= 'A';
On Thursday, 11 January 2018 at 12:24:36 UTC, Nordlöw wrote:
How do I check whether an aggregate member function (call for a
specific argument) is @nogc or not?
I want to check whether
Allocator.allocate(1)
(for a any Allocator) is @nogc or not?
Is
https://dlang.org/phobos/std_traits.ht
I want to create a library and eventually publish it via the DUB
registry.
Is there a simple example that shows how to test the library
during development, before publishing (ie, before being able to
add it as a dependency to another project)?
I guess I'm just asking, what's the convention h
How do I check whether an aggregate member function (call for a
specific argument) is @nogc or not?
I want to check whether
Allocator.allocate(1)
(for a any Allocator) is @nogc or not?
Is
https://dlang.org/phobos/std_traits.html#hasFunctionAttributes
the way to do it?
On Thursday, 11 January 2018 at 11:21:08 UTC, tipdbmp wrote:
string push_stuff(char[] buf, int x) {
if (x == 1) {
buf ~= 'A';
buf ~= 'B';
buf ~= 'C';
return cast(string) buf[0 .. 3];
}
else {
buf ~= 'A';
buf ~= 'B';
return cast(s
string push_stuff(char[] buf, int x) {
if (x == 1) {
buf ~= 'A';
buf ~= 'B';
buf ~= 'C';
return cast(string) buf[0 .. 3];
}
else {
buf ~= 'A';
buf ~= 'B';
return cast(string) buf[0 .. 2];
}
}
void foo() {
{
char[2
string push_stuff(char[] buf, int x) {
if (x == 1) {
buf ~= 'A';
buf ~= 'B';
buf ~= 'C';
return cast(string) buf[0 .. 3];
}
else {
buf ~= 'A';
buf ~= 'B';
return cast(string) buf[0 .. 2];
}
}
void foo() {
{
char[2
On Thursday, 11 January 2018 at 08:59:01 UTC, Chirs Forest wrote:
I'm using std.variant.Variant to hold a value of unknown type
(not a string, could be a numeric type or a container holding
multiple numeric types). I'm trying to retrieve this value with
.get!T but I need the type to do that...
On Thursday, January 11, 2018 08:59:01 Chirs Forest via Digitalmars-d-learn
wrote:
> I'm using std.variant.Variant to hold a value of unknown type
> (not a string, could be a numeric type or a container holding
> multiple numeric types). I'm trying to retrieve this value with
> .get!T but I need t
I'm using std.variant.Variant to hold a value of unknown type
(not a string, could be a numeric type or a container holding
multiple numeric types). I'm trying to retrieve this value with
.get!T but I need the type to do that... .type gives me TypeInfo,
but that's not a type so I'm not sure how
When I try add some sub type for struct with mixin template,
seems there is no way to hidden the private type.
Is there a way to hidden type from mix template like Voldemort
type ?
fake code:
mix template TypeX () {
alias This = typeof(this);
static struct Unique {
This* _ptr
48 matches
Mail list logo