On Saturday, 1 October 2022 at 17:50:54 UTC, tsbockman wrote:
but unless it is provided with a good estimate of the final
length at the beginning, it will allocate several times for
a longer string, and the final buffer will be, on average, 50%
larger than needed.
I see, it's smart!
SDB@79
On 10/2/22 09:24, Fausto via Digitalmars-d-learn wrote:
Thanks a lot. I am to used to C and, more important, I didn't think to look for
also another operator for the power function :)
D does have pow and many other useful math functions [1], it's just not defined
for BitInts. Oh, and
On Friday, 30 September 2022 at 22:56:06 UTC, Ogi wrote:
On Thursday, 29 September 2022 at 12:49:06 UTC, Riccardo M
wrote:
When interfacing to C++, disregard the keyword and look at the
implementation instead. If all its member functions are
non-virtual, map it to struct. Otherwise map it to
On 10/2/22 09:24, Fausto via Digitalmars-d-learn wrote:
Thanks a lot. I am to used to C and, more important, I didn't think to look for
also another operator for the power function :)
Oh, and I forgot to mention that this is doing what you probably asked for
originally:
```d
import std;
On Sunday, 2 October 2022 at 02:02:37 UTC, rassoc wrote:
On 10/2/22 00:04, Fausto via Digitalmars-d-learn wrote:
Hello,
I am trying to use pow with an integer argument, but I cannot
have a bigint result, for example, ```pow(10,72)```.
Do I have to write my pow function or is there a native
On Sunday, 2 October 2022 at 11:00:06 UTC, Daniel Donnell, Jr
wrote:
I thought I set everything up correctly, and now:
```
Exception thrown at 0x7FF7D6E2E230 in metamath-d.exe:
0xC096: Privileged instruction.
Unable to open natvis file
On Sunday, 2 October 2022 at 11:33:47 UTC, Imperatorn wrote:
I only have Visual Studio 2022. Will the installer be updated
to support that or am I missing some components?
![Installer](https://i.ibb.co/sCZRFRf/installer.jpg)
You should be fine. Select the bottom option since you already
On Sunday, 2 October 2022 at 16:44:25 UTC, Paul Backus wrote:
It's because `writeln` is copying the object, and each of the
copies is being destroyed. If you add a copy constructor to
your example, you can see it happening:
...
I thought something like this could be happening in my original
On Sunday, 2 October 2022 at 17:19:55 UTC, data pulverizer wrote:
Any reason why this could be?
Sorry I'll need to implement all the overloaded copy constructors
and see if that fixes it.
On Sunday, 2 October 2022 at 17:51:59 UTC, Ali Çehreli wrote:
What I noticed first in your original code was that it would be
considered buggy because it was not considering copying. Every
struct that does something in its destructor should either have
post-blit (or copy constructor) defined
On Sunday, 2 October 2022 at 18:24:51 UTC, Ali Çehreli wrote:
I've just tested. That is used only for explicit constructor
syntax ...
Many thanks. Knowledgeable as always!
I only have Visual Studio 2022. Will the installer be updated to
support that or am I missing some components?
![Installer](https://i.ibb.co/sCZRFRf/installer.jpg)
Thanks!
On Sunday, 2 October 2022 at 12:37:37 UTC, Mike Parker wrote:
On Sunday, 2 October 2022 at 11:33:47 UTC, Imperatorn wrote:
I only have Visual Studio 2022. Will the installer be updated
to support that or am I missing some components?
![Installer](https://i.ibb.co/sCZRFRf/installer.jpg)
You
On Sunday, 2 October 2022 at 11:00:06 UTC, Daniel Donnell, Jr
wrote:
I thought I set everything up correctly, and now:
```
Exception thrown at 0x7FF7D6E2E230 in metamath-d.exe:
0xC096: Privileged instruction.
Unable to open natvis file
On 10/2/22 10:28, data pulverizer wrote:
> On Sunday, 2 October 2022 at 17:19:55 UTC, data pulverizer wrote:
>> Any reason why this could be?
>
What I noticed first in your original code was that it would be
considered buggy because it was not considering copying. Every struct
that does
On Sunday, 2 October 2022 at 17:28:51 UTC, data pulverizer wrote:
Sorry I'll need to implement all the overloaded copy
constructors and see if that fixes it.
I've got it, something weird happened to my copy constructor.
This was my original attempt and was ignored (didn't run in the
copy
On 10/2/22 10:55, data pulverizer wrote:
> On Sunday, 2 October 2022 at 17:28:51 UTC, data pulverizer wrote:
>> Sorry I'll need to implement all the overloaded copy constructors and
>> see if that fixes it.
>
> I've got it, something weird happened to my copy constructor. This was
> my original
I've noticed that `writeln` calls the destructor of a struct
multiple times and would like to know how to stop this from
happening. It has become a very serious problem when working with
objects that have memory management external to D.
Here is a repeatable example, where the destructor
On Sunday, 2 October 2022 at 16:21:47 UTC, data pulverizer wrote:
I've noticed that `writeln` calls the destructor of a struct
multiple times and would like to know how to stop this from
happening.
It's because `writeln` is copying the object, and each of the
copies is being destroyed. If
On Sunday, 2 October 2022 at 18:24:51 UTC, Ali Çehreli wrote:
On 10/2/22 10:55, data pulverizer wrote:
> ```
> this(T)(ref return scope T original)
> if(is(T == RVector!(Type)))
> {
> //... code ...
> }
> ```
I've just tested. That is used only for explicit constructor
syntax:
auto
On Sunday, 2 October 2022 at 21:03:40 UTC, rassoc wrote:
But say, I'm curious, what's the purpose of adding an
optional/useless contents field? What's the use-case here?
We have a class/struct for a data record,
some of its data fields need to be saved/loaded from CSV files;
while there are
I got the answer thanks to IRC chat:
https://dlang.org/spec/declaration.html#void_init
On 10/2/22 21:48, mw via Digitalmars-d-learn wrote:
```
text.csvReader!Layout(["b","c","a"]); // Read only these column
```
The intention is very clear: only read the selected columns from the csv, and
for any other fields of class Layout, just ignore (with the default D .init
Visual Studio with its c++ components can debug D code, it should not
require Visual D to do so.
Open executable as project.
If this does not work, you have a serious issue in your system/VS install.
This may help to narrow down what is going on.
On 10/2/22 23:18, mw via Digitalmars-d-learn wrote:
A CSV library should consider all the use cases, and allow users to ignore
certain fields.
Filed issue: https://issues.dlang.org/show_bug.cgi?id=23383
Let's see what others have to say.
On 10/3/22 02:30, ryuukk_ wrote:
I have tried to look at the documentation and various places on the DMD
source, but i couldn't find the answer
https://dlang.org/spec/declaration.html#void_init
```D
MyStruct test = void;
```
Does this guarantee that the compiler will not initialize it?
Hi,
I'm following the example on
https://dlang.org/phobos/std_csv.html
```
class Layout
{
int value;
double other;
string name;
int extra_field; // un-comment to see the error
}
void main()
{
import std.csv;
import std.stdio: write,
```
text.csvReader!Layout(["b","c","a"]); // Read only these
column
```
The intention is very clear: only read the selected columns from
the csv, and for any other fields of class Layout, just ignore
(with the default D .init value).
I have tried to look at the documentation and various places on
the DMD source, but i couldn't find the answer
```D
MyStruct test = void;
```
Does this guarantee that the compiler will not initialize it?
Does it work with static arrays of struct too?
The generated code is different than
29 matches
Mail list logo