On Saturday, 17 October 2020 at 00:06:31 UTC, Steven
Schveighoffer wrote:
Appender is ref counted IIRC.
-Steve
It's not; it uses the GC.
On 10/16/20 8:23 PM, Marcone wrote:
How convert String to Fixed wchar Array?
import std;
void main(){
string name = "Marvin";
wchar[255] wtext = name.to!(wchar[]); // Can not convert.
writeln(wtext);
}
void main()
{
string name = "Marvin";
wchar[255] wtext;
import s
How convert String to Fixed wchar Array?
import std;
void main(){
string name = "Marvin";
wchar[255] wtext = name.to!(wchar[]); // Can not convert.
writeln(wtext);
}
On 10/16/20 5:40 PM, Per Nordlöw wrote:
Why is `Appender`'s store `Data` put directly as
`private Data* _data;`
instead of
`private Data _data;`
?
Removing the pointer indirection would give better locality.
If it's about optimizing for empty `Appender`s then a `Appender*` should
On 10/16/20 4:12 PM, WhatMeWorry wrote:
> Isn't dlopen() for Linux
More like dlopen() is for Posix, which means it should be available on
Windows as well.
However, as I've discovered, a D shared library cannot be loaded with
dlopen() because the main program and the shared library would do t
On Friday, 16 October 2020 at 15:14:03 UTC, Ali Çehreli wrote:
On 10/15/20 2:42 PM, Ali Çehreli wrote:
> I've recently done the same by calling dlopen() and dlsym()
> directly. Runtime.loadLibrary documentation says "If the
library
> contains a D runtime it will be integrated with the current
ru
On 10/16/20 1:10 PM, Marcone wrote:
How can I convert Hexadecimal to RGB Color and vice-versa?
On 10/16/20 1:10 PM, Marcone wrote:
> How can I convert Hexadecimal to RGB Color and vice-versa?
Do you mean from a string like "#123456" to the values of red, green,
and blue? I am having more fun
Why is `Appender`'s store `Data` put directly as
`private Data* _data;`
instead of
`private Data _data;`
?
Removing the pointer indirection would give better locality.
If it's about optimizing for empty `Appender`s then a `Appender*`
should be used in those cases instead.
On Friday, 16 October 2020 at 19:55:53 UTC, wilcro wrote:
The web page "Programming in D for C Programmers"
(https://dlang.org/articles/ctod.html#forwardfunc) states that
forward declarations are neither required nor permitted, and
that the following construct is allowable:
void myfunc()
{
On 10/16/20 4:47 PM, wilcro wrote:
Thanks to all for your responses; as a related followup question, would
there be any reason to avoid placing the majority of code for a program
outside of the main function?
Inner functions have benefits:
1. They are only accessible inside the function. W
On 10/16/20 4:44 PM, ag0aep6g wrote:
On 16.10.20 22:32, Per Nordlöw wrote:
Why is `T.sizeof` 12 instead of 8 when `U.sizeof` is 8 in the
following example?
struct S
{
int i;
bool b;
}
struct T
{
S s;
char c;
}
struct U
{
int i;
bool b;
char c;
}
?
S.size
On 10/16/20 1:47 PM, wilcro wrote:
> would
> there be any reason to avoid placing the majority of code for a program
> outside of the main function?
Keeping scopes of symbols as small as possible is a general guideline in
D and elsewhere but I wouldn't crowd my main() function with details of
On 10/16/20 1:32 PM, Per Nordlöw wrote:
Why is `T.sizeof` 12 instead of 8 when `U.sizeof` is 8 in the following
example?
struct S
{
int i;
bool b;
}
struct T
{
S s;
char c;
}
struct U
{
int i;
bool b;
char c;
}
?
I have a function that dumps member layout
On Friday, 16 October 2020 at 19:55:53 UTC, wilcro wrote:
The web page "Programming in D for C Programmers"
(https://dlang.org/articles/ctod.html#forwardfunc) states that
forward declarations are neither required nor permitted, and
that the following construct is allowable:
void myfunc()
{
On 16.10.20 22:32, Per Nordlöw wrote:
Why is `T.sizeof` 12 instead of 8 when `U.sizeof` is 8 in the following
example?
struct S
{
int i;
bool b;
}
struct T
{
S s;
char c;
}
struct U
{
int i;
bool b;
char c;
}
?
S.sizeof: 4 bytes for the int + 1 byte for t
Why is `T.sizeof` 12 instead of 8 when `U.sizeof` is 8 in the
following example?
struct S
{
int i;
bool b;
}
struct T
{
S s;
char c;
}
struct U
{
int i;
bool b;
char c;
}
?
On Fri, Oct 16, 2020 at 08:04:07PM +, Imperatorn via Digitalmars-d-learn
wrote:
[...]
> I think it might be just because you havent defined the function yet
> at that point.
That's not correct; the following works:
module mymodule;
void func() {
forwardfunc()
On Fri, Oct 16, 2020 at 07:55:53PM +, wilcro via Digitalmars-d-learn wrote:
> The web page "Programming in D for C Programmers"
> (https://dlang.org/articles/ctod.html#forwardfunc) states that forward
> declarations are neither required nor permitted,
[...]
> However, the following code will ca
How can I convert Hexadecimal to RGB Color and vice-versa?
On Friday, 16 October 2020 at 19:55:53 UTC, wilcro wrote:
The web page "Programming in D for C Programmers"
(https://dlang.org/articles/ctod.html#forwardfunc) states that
forward declarations are neither required nor permitted, and
that the following construct is allowable:
void myfunc()
{
On Friday, 16 October 2020 at 19:55:53 UTC, wilcro wrote:
Evidently, I am misunderstanding something very elemental here;
thanks for any enlightenment regarding this.
Inside a function things happen in order, top to bottom,
including declarations (you can only access local variables after
the
The web page "Programming in D for C Programmers"
(https://dlang.org/articles/ctod.html#forwardfunc) states that
forward declarations are neither required nor permitted, and that
the following construct is allowable:
void myfunc()
{
forwardfunc();
}
void forwardfunc()
{
... //do stuff
On 10/16/20 9:05 AM, Steven Schveighoffer wrote:
> The destruction of members is outside the destructor's purview. It can't
> turn the destruction off, so it should logically be considered part of
> an enclosing function.
Thank you. Makes sense.
Ali
On 10/16/20 11:11 AM, Ali Çehreli wrote:
On 10/16/20 6:12 AM, tchaloupka wrote:
> struct Foo {
> Bar bar;
> bool err;
>
> ~this() {
> // scope(failure) destroy(bar); // < this fixes the Bar
> destructor call
> enforce(!err, "Test err");
Well, that check
On 10/16/20 9:12 AM, tchaloupka wrote:
So when the exception is thrown within Foo destructor (and it's bad on
it's own but can easily happen as destructors aren't nothrow @nogc by
default).
Is this behavior expected?
I would say it's a bug. The compiler is going to call the member
destruct
On Friday, 16 October 2020 at 15:19:51 UTC, Paul Backus wrote:
On Friday, 16 October 2020 at 13:12:04 UTC, tchaloupka wrote:
So when the exception is thrown within Foo destructor (and
it's bad on it's own but can easily happen as destructors
aren't nothrow @nogc by default).
Is this behavior
On Friday, 16 October 2020 at 13:12:04 UTC, tchaloupka wrote:
So when the exception is thrown within Foo destructor (and it's
bad on it's own but can easily happen as destructors aren't
nothrow @nogc by default).
Is this behavior expected?
This is a compiler/language bug. It was fixed in DMD
On 10/15/20 2:42 PM, Ali Çehreli wrote:
> I've recently done the same by calling dlopen() and dlsym()
> directly. Runtime.loadLibrary documentation says "If the library
> contains a D runtime it will be integrated with the current runtime."
> That would explain why my program seg-faults for my fi
On 10/16/20 6:12 AM, tchaloupka wrote:
> struct Foo {
> Bar bar;
> bool err;
>
> ~this() {
> // scope(failure) destroy(bar); // < this fixes the Bar
> destructor call
> enforce(!err, "Test err");
Well, that check means "cannot continue", which means the compiler
On Friday, 16 October 2020 at 13:27:57 UTC, Imperatorn wrote:
https://forum.dlang.org/post/e5ghnv$2bns$1...@digitaldaemon.com
On Tuesday, 30 May 2006 at 04:29:51 UTC, BCS wrote:
Does anyone have a link to a definition of universal alpha as
used in the DMD docs?
(see: http://www.digitalmars.co
https://forum.dlang.org/post/e5ghnv$2bns$1...@digitaldaemon.com
On Tuesday, 30 May 2006 at 04:29:51 UTC, BCS wrote:
Does anyone have a link to a definition of universal alpha as
used in the DMD docs?
(see: http://www.digitalmars.com/d/lex.html#identifier)
For any other lonely souls looking f
Found a pretty nasty bug in vibe-d:
https://github.com/vibe-d/vibe.d/issues/2484
And it's caused by this behavior.
```D
import std;
struct Foo {
Bar bar;
bool err;
~this() {
// scope(failure) destroy(bar); // < this fixes the Bar
destructor call
enforce(!err, "Te
Thank you!
On Friday, 16 October 2020 at 08:12:59 UTC, Andrey wrote:
Hi,
I have got:
struct Qaz
{
wstring read() {return null;}
wstring hear() {return "";} }
void main()
{
// ...
static if(some_condition) alias method = Qaz.hear;
else alias method = Qaz.read;
// ...
Qaz qa
Hi,
I have got:
struct Qaz
{
wstring read() {return null;}
wstring hear() {return "";} }
void main()
{
// ...
static if(some_condition) alias method = Qaz.hear;
else alias method = Qaz.read;
// ...
Qaz qaz;
qaz.method(); // ???
}
How to call alias "method"
35 matches
Mail list logo