On Mon, Sep 25, 2017 at 05:28:13AM +, WhatMeForget via Digitalmars-d-learn
wrote:
>
> This is taken exactly from the traits documentation.
>
>
>
> 25 Traits
>
> 25.21 identifier
>
> Takes one argument, a symbol. Returns the identifier for t
On 25/09/2017 6:28 AM, WhatMeForget wrote:
This is taken exactly from the traits documentation.
25 Traits
25.21 identifier
Takes one argument, a symbol. Returns the identifier for that symbol as
a string literal.
---
This is taken exactly from the traits documentation.
25 Traits
25.21 identifier
Takes one argument, a symbol. Returns the identifier for that
symbol as a string literal.
There are no example
In your case, the postblit of Bar is still going to run and add
a ref to it's count when you place it in Foo, right? That means
that if you don't destroy it, it will leak memory or resources.
Actually no. Since when Foo (class that instantiates Bar) gets
GCed, that is the point that I need t
On Monday, 25 September 2017 at 01:46:15 UTC, Haridas wrote:
[...]
It all works well so far. But as soon as I create an instance
of Bar inside a Dlang class (say Foo) or as part of a Dlang
dynamic array, hell follows. At some point, Dlang's GC kicks in
and Bar's destructor gets called from wi
In general, of course, this is a bad idea - there's probably a
reason that destructor does the thing it's doing. If you're
sure skipping it is what you want, go ahead.
@Biotronic, the code you have provided may be exactly what I am
looking for. Let me explain my situation.
I have a library t
On Sunday, 24 September 2017 at 17:11:26 UTC, Haridas wrote:
In the following code, Bar is an element of struct Foo. Is
there a way to avoid a call to ~Bar when ~Foo is getting
executed?
Don't construct it to begin with.
struct Bar {
import std.stdio : writeln;
int a = 123;
void
On Sunday, 24 September 2017 at 18:00:32 UTC, Adam D. Ruppe wrote:
I think readf("%s") reads everything available. readf(" %s\n")
might help but personally, I say avoid readf.
Just use readln and to!int instead
auto line = readln();
if(line.length == 0)
writeln("please enter a number");
a
On Sunday, 24 September 2017 at 18:46:15 UTC, Haridas wrote:
Also consider the following code. Please let me know if I am
doing the right thing for dynamic arrays. My hack seems to have
the desired effect on shutting down the destructor. Is this
hack legal use of D? Can you please guide me if/h
On Sunday, 24 September 2017 at 17:05:11 UTC, Neia Neutuladh
wrote:
On Sunday, 24 September 2017 at 16:13:30 UTC, dark777 wrote:
when you execute and call
Name:
I type my name:
Name: dark777 + [enter]
and he does not jump to the next line to get the age
This is what I want to know how to solve
Also consider the following code. Please let me know if I am
doing the right thing for dynamic arrays. My hack seems to have
the desired effect on shutting down the destructor. Is this hack
legal use of D? Can you please guide me if/how it can be achieved
for std.container.Array?
//
impo
Thanks Adam
Actually Bar's API and implementation is not in my control.
Consider the scenario where it is implemented in a library. Or a
scenario where I have millions of instances of Bar (not
necessarily as a component of Foo) and I do not want to add to
runtime memory footprint.
Ok, consi
I think readf("%s") reads everything available. readf(" %s\n")
might help but personally, I say avoid readf.
Just use readln and to!int instead
auto line = readln();
if(line.length == 0)
writeln("please enter a number");
age = to!int(line);
to is from import std.conv
On Sunday, 24 September 2017 at 17:11:26 UTC, Haridas wrote:
In the following code, Bar is an element of struct Foo. Is
there a way to avoid a call to ~Bar when ~Foo is getting
executed?
No, but you could just set a flag in Bar that the destructor
checks and skips running if it is set.
In f
In the following code, Bar is an element of struct Foo. Is there
a way to avoid a call to ~Bar when ~Foo is getting executed?
// >>
import std.stdio;
struct Foo {
Bar bar;
~this() {
writeln("~Foo");
// some code that disables call to ~Bar
}
}
struct Bar {
~this() {
On Sunday, 24 September 2017 at 16:13:30 UTC, dark777 wrote:
when you execute and call
Name:
I type my name:
Name: dark777 + [enter]
and he does not jump to the next line to get the age
This is what I want to know how to solve.
Add a `writeln();` after reading input, maybe?
On Sunday, 24 September 2017 at 15:51:01 UTC, dark777 wrote:
On Sunday, 24 September 2017 at 15:22:30 UTC, Suliman wrote:
On Sunday, 24 September 2017 at 14:32:14 UTC, dark777 wrote:
I have the following code:
https://pastebin.com/PWuaXJNp
but typing my name does not go to the next line as soon
On Sunday, 24 September 2017 at 15:22:30 UTC, Suliman wrote:
On Sunday, 24 September 2017 at 14:32:14 UTC, dark777 wrote:
I have the following code:
https://pastebin.com/PWuaXJNp
but typing my name does not go to the next line as soon as I
press enter
how to solve this?
use writeln instead w
On Sunday, 24 September 2017 at 14:32:14 UTC, dark777 wrote:
I have the following code:
https://pastebin.com/PWuaXJNp
but typing my name does not go to the next line as soon as I
press enter
how to solve this?
use writeln instead write
I have the following code:
https://pastebin.com/PWuaXJNp
but typing my name does not go to the next line as soon as I
press enter
how to solve this?
20 matches
Mail list logo