On Saturday, 27 November 2021 at 15:29:45 UTC, Adam D Ruppe wrote:
On Saturday, 27 November 2021 at 15:24:43 UTC, Coder wrote:
Question, why a function can not be nothrow if I catch in the
body?
Ever play Pokemon? You can't just catch the cute Bulbasaur and
call it done (even thoug
On Saturday, 27 November 2021 at 13:56:46 UTC, Adam D Ruppe wrote:
On Saturday, 27 November 2021 at 13:54:11 UTC, Coder wrote:
My application is receiving data over a socket as
immutable(ubyte)[].
How to validate them and transform them to utf8 string? What
is the best way?
If they
I'm lost, std.utf, std.conv, std.encoding, std.uni
My application is receiving data over a socket as
immutable(ubyte)[].
How to validate them and transform them to utf8 string? What is
the best way?
Thank you!
On Tuesday, 21 July 2020 at 12:21:16 UTC, Steven Schveighoffer
wrote:
On 7/21/20 7:44 AM, Ecstatic Coder wrote:
On Tuesday, 21 July 2020 at 11:01:20 UTC, drug wrote:
On 7/20/20 10:04 PM, Ecstatic Coder wrote:
I'm currently implementing a small open source backup tool
(dub), and theref
On Tuesday, 21 July 2020 at 11:01:20 UTC, drug wrote:
On 7/20/20 10:04 PM, Ecstatic Coder wrote:
I'm currently implementing a small open source backup tool
(dub), and therefore I need to accurately store the file
modification SysTime in binary format, so that I can later
load this Sy
As my question obviously didn't interest any expert, I took
advantage of my lunch break to do some more research ;)
Maybe I'm wrong, but to my knowledge, there is no function to get
the number of hectonanoseconds since January 1, 1970.
Fortunately I can get the number of seconds since the sam
I'm currently implementing a small open source backup tool (dub),
and therefore I need to accurately store the file modification
SysTime in binary format, so that I can later load this SysTime
from the snapshot file to compare it with the current file
modification SysTime.
Having unfortunatel
On Saturday, 3 November 2018 at 18:04:07 UTC, Stanislav Blinov
wrote:
On Saturday, 3 November 2018 at 17:26:19 UTC, Ecstatic Coder
wrote:
void main() {
double value = -12.000123456;
int precision = 50;
import std.stdio;
writefln("%.*g", precision, value);
Actually, what I need is the D equivalent of the default
ToString() function we have in Dart and C#.
I don't think it means what you think it means:
void main() {
double value = -12.000123456;
int precision = 50;
import std.stdio;
writefln("%.*g", precision, value);
import
On Saturday, 3 November 2018 at 12:45:03 UTC, Danny Arends wrote:
On Saturday, 3 November 2018 at 12:27:19 UTC, Ecstatic Coder
wrote:
import std.conv;
import std.stdio;
void main()
{
double value = -12.000123456;
writeln( value.sizeof );
writeln( value );
writeln( value.to
import std.conv;
import std.stdio;
void main()
{
double value = -12.000123456;
writeln( value.sizeof );
writeln( value );
writeln( value.to!string() );
writeln( value.to!dstring() );
}
/*
8
-12.0001
-12.0001
-12.0001
*/
In Dart, value.toString() returns "-12.000123456".
In C
On Friday, 15 December 2017 at 21:55:12 UTC, Michael wrote:
On Friday, 15 December 2017 at 21:29:10 UTC, Jonathan M Davis
wrote:
On Friday, December 15, 2017 20:40:10 Ecstatic Coder via
Digitalmars-d-learn wrote:
It's taken me some time to find an implicit cast bug
It's taken me some time to find an implicit cast bug ("if
(my_sometimes_negative_index >= this_array.length)"), while a
simple C++-like implicit-cast warning would have allowed me to
find this nasty bug WAY sooner...
Why is it put in quarantine? Posting the reason and some
information about it would help a lot to identify the issue.
If I remember well, it has detected a "W32/exploit.gen".
The file was put in quarantine in the second I tried to execute
the installer.
Here is the current VirusTotal analysi
But no problem with any file stored inside the current .7z
archive file.
So I guess the problem comes from the installer executable itself.
Please try to fix this as soon as possible, as this immediately
drives people away from D before they even got a chance to
install it...
Greetings
I have a question on class destructor method. D documentation for
destructors says:
"The garbage collector is not guaranteed to run the destructor for
all unreferenced objects. Furthermore, the order in which the garbage
collector calls destructors for unreference ob
Thanks Jonathan
Do you think this could make a good enhancement request?
Regards
- Puneet
On Sat, Jun 1, 2013 at 9:34 PM, Jonathan M Davis wrote:
> On Saturday, June 01, 2013 20:21:42 d coder wrote:
> > Greetings
> >
> > Is there a way to initialize an associative arr
Greetings
Is there a way to initialize an associative array to a non-null (but still
empty) state? The only way I know is by adding an element and then removing
it. Did I miss something obvious? Basically I want to write lines 7-8 in
the following code in a cleaner fashion. Any ideas?
Regards
- P
Thanks for the quick and helpful reply. I will give it a shot.
On Friday, 25 May 2012 at 06:36:07 UTC, Jacob Carlborg wrote:
On 2012-05-25 08:15, #coder wrote:
Hi,
I am using the Mono-D for building a project with 3-4 library
projects
and one console project. Although I am using the Mono-D
Hi,
I am using the Mono-D for building a project with 3-4 library
projects and one console project. Although I am using the Mono-D
but I think this issue is not unique to Mono-D. Please advise me
with a solution, if I am missing something obvious here.
Issue;
I have two "library" project wi
As for mysqln, I merged jrogers patches and changed uint to
size_t so it compiles on x64.
You can look at it here:
https://github.com/simendsjo/mysqln/tree/compile-on-recent-dmd
It hasn't been tested beyond connecting to the database and
fetching metadata yet.
And my repository will go away ve
>
>
> I've copy and pasted my reply to Benjamin below, you should be able to
> adapt it to your needs:
>
Stupid me. Should have checked the list before posting.
>
> The only way I've found to do this that works is using an alias - this is
> probably worth a bug report if there isn't one already.
Greetings
I am facing problem passing a shared class method as an argument to a
function. Look at the following minimized code snippet.
class Foo {
shared // compiles when commented out
void bar() {}
}
void frop(void delegate() dg) {
}
void main() {
shared Foo foo = new shared(Foo);
f
Greetings All
It has been 2 months since we had release 2.052. Just wondering when is the
2.053 release planned?
Also, is there an automated way to create a snapshot release from the git
repositories?
Regards
- Puneet
Greetings
Please look at the code down here. When compiled and run, I get the message
"Call to postblit" printed. I think it is because of the foreach block,
because the variable "i" is not declared as ref there. Is there a way to
make it a ref?
Regards
- Puneet
import std.stdio;
struct Foo {
Greetings
Do I need to declare instances of Semaphores, Mutexes and Barriers shared?
In most situations these objects would be naturally accessed by many
threads.
Regards
- Puneet
>
>
> It's probably complaining because using shared without synchronizing is
> generally very foolish. Now, I would have _thought_ that it would still
> work
> without, but I apparently not. Regardless, I'm not sure why you'd want to
> use
> shared anything without synchronizing your access of it.
Greetings
Why is it necessary to use synchronized functions when passing shared
variables? I get error even when I am not modifying the shared variable in
the function.
Kindly look at the following code. I get a compile error unless I declare
the functions parent and root synchronized.
The compil
> I'm afraid that I have no idea what would be "stale" about a shared
variable.
> sychronized uses a mutex, and if you want to avoid race conditions, you
need to
> use mutexes or something similar when dealing with shared variables. But I
don't
> know what would be "stale" about a variable.
>
One
Greetings
I have a doubt about synchronized code blocks.
I learnt that in Java the synchronized keyword has two fold effect.
Firstly it locks the code to make sure that only a single thread gets
access to the code block at a given time. Secondly, it makes sure that
the data elements accessed insi
Thanks Simon.
Greetings
I tried to initialize a struct member with a function pointer, and
found that DMD2 did not like it. Are not function pointers compile
time constants? And why they should not be?
Regards
- Cherry
Greetings
I am getting this error when I am instantiating a struct array with a
single element inside another class and only if there is the
destructor for the struct is explicitly defined. Is it a known error?
Here is a minimized snippet that gives error:
$ rdmd --main -unittest test.d
Error: t
> However, it's not generally an issue, because you shouldn't normally be
> keeping
> references around for stuff that isn't used anymore. The garbage collector is
> smart enough to deal with circular references and the like, so the biggest
> cases
> where you'd normally need weak references aren
> If you know roughly what to do and want to take a stab at producing a viable
> patch to fix the problem, then feel free. If it's solid, it may get in. I
> don't
> know. It doesn't hurt to try though (as long as you're prepared for the fact
> that it may not be accepted).
Thanks for letting me k
> Also tango (for D 1.0) implements it.
> Link:
> http://www.dsource.org/projects/tango/docs/current/tango.core.WeakRef.html
>
> Might be worth a look if you are going to implement it for D 2.0.
>
I looked at the D1 implementation. It depends on GC methods
weakPointerCreate and weakPointerDestroy.
> I believe what you're referring to is generally called a Weak
> Reference, which is a reference that the GC doesn't consider when
> deciding to keep an object alive, but that the GC will update if an
> object dies.
> There's a feature request at
> http://d.puremagic.com/issues/show_bug.cgi?id=41
Greetings
I am in a situation where I need to know the number of references to a
class' object. To explain, I have an array of class objects and I
occasionally process this array. But if a particular object in this
array is not being garbage collected just because it is part of this
array, I would
Thanks Lars and Bearophile, I will give it a try.
I understand that static downcasting is dangerous. But there are
places where efficiency is paramount and you are sure that the casting
is safe. So I wholeheartedly second your proposal to have the stuff in
phobos.
Regards
- Cherry
Greetings All
I have learnt that D has only one casting operator and that is 'cast'.
The same operator assumes different functionality depending on the
context in which it he being used.
Now I have a situation where I have to downcast an object and I am
sure of the objects type and thereby I am s
Greetings
Is there a limit on the maximum number of threads that can be
spawned? Or does it just depend on the value in
/proc/sys/kernel/threads-max on a linux system?
Regards
- Cherry
> A struct nested in a class does not have a hidden "outer" pointer as a
> nested class does. It's because a struct is generally more bare-bones than
> a class (which has loads of hidden pieces: vtable, interfaces, classinfo,
> etc.). Also, instantiating such a struct does not tie it to a class
>
Greetings All
I have a situation where I have a struct nested inside a class. I
would like to make the enclosing class' members visible inside the
nested struct's constructor. I see that such preposition is feasible
for nested classes, but not for nested structs. Why so?
Are there some alternativ
> I do know the template. I will try out your solution. Will let you
> know if I face issues.
>
Simen
It works perfect, And this is exactly what I was looking for. If you
see my original post, I also thought this form of "is" expression
should work. Just could not get around to the right syntax.
> S!int foo;
> static if ( is( typeof(foo) f == S!T, T ) ) {
> // Here, T == int, f == typeof(foo)
> }
>
> Note that the syntax "is ( Type Identifier : TypeSpecialization ,
> TemplateParameterList )" is only usable inside static if.
>
Thanks Simen
I do know the template. I will try out your so
> For instance, given your definiton of S, you could use
> _traits/std.traits to check that the type that you're testing has a member
> variable t. You could then check that S!(typeof(t)) was the same as the type
> that you were testing. So, if you get particularly cunning about it, I believe
> tha
Greetings
I want to find if a given struct type is instantiated from a
particular template struct type. For example:
struct S (T) {
alias T Type;
T t;
}
And later I want to find out if a given type is of type S(*)
(basically any type instantiated from template struct S). In fact I do
not kn
> I'm curious, why do you need that?
>
It is a long story.
But basically I am creating a platform wherein the users would be
deriving classes from some base classes that I write as part of the
platform. And the users would often be deriving many such classes.
The end-users would often not be pro
Greetings
I need a way to know (using traits or other compile time constructs)
all the types derived from a given type.
Is it possible in D?
Is it possible to get a list of all the user-defined classes? I could
use that to filter out the classes that I need.
Regards
Cherry
> Ah.. Now I think I understand.
>
> This new code I have written will all be run at compile time. So in
> this case, the foreach statement inside the constructor would be
> reduced to a bunch of writeln statements at compile time and those
> writeln would be executed at the run time. This will not
> Another thing, is(T : U) simply means T is implicitly castable to U. Due to
> a compiler bug, Bar[] is implicitly castable to BaseClass[].
>
Steve
I realize that I am using this compiler bug as a feature. It would be
kind of you to suggest me a code that would not exploit this bug. I
was think
> What you are saying makes sense to me. The problem is that the
> following code works perfectly. I have just commented out some part
> and replaced it with some debug statements.
Ah.. Now I think I understand.
This new code I have written will all be run at compile time. So in
this case, the fo
> Is there a reason you can't directly reference the members? After all, you
> are writing the class.
>
Thanks Steve for your inputs.
Actually this is part of a bigger code that I am trying to create.
Though I am pretty new to D.
What I have posted is a reduced code that illustrated the issue I
> if(false) {
> for (size_t j = 0; j < f.length...)
> ...
> }
>
> Semantically this code is wrong as you can't take the length of f which is
> class Bar. The static if forces the compiler to not generate this code as it
> is known to be false.
>
Thanks Jesse
What you are saying makes sens
Greetings All
I am trying to compile the following D2 code. The code giving compilation
issues is the "this()" function of the class Foo. The constructor basically
tries to initialize all the data members of the class, of type BaseClass and
of type BaseClass array.
I am using class property tuple
55 matches
Mail list logo