Re: Doubt about char.min/max == typeid(char)

2022-10-06 Thread bauss via Digitalmars-d-learn
On Friday, 7 October 2022 at 04:40:26 UTC, matheus wrote: Hmm well I was thinking the min/max as a range/limits, in this case 0 to 255 or it could be -128 to 127 if signed char casts implicitly to int, so if you really need it as an integer type just type your variable as such. ```d int a

Re: Doubt about char.min/max == typeid(char)

2022-10-06 Thread matheus via Digitalmars-d-learn
On Friday, 7 October 2022 at 01:02:57 UTC, torhu wrote: On Friday, 7 October 2022 at 00:13:59 UTC, matheus wrote: Hi, Could anyone please tell me why the properties of min/max of a char returns a "char type" and not a value as an int? Well, why whould the highest and lowest values of a type

cannot gdb LDC build binary: Segmentation fault

2022-10-06 Thread mw via Digitalmars-d-learn
Hi, I have a LDC (1.30.0) built binary on Ubuntu 18.04.5 LTS x86_64, the program core dumps somewhere, so I want to debug it. However under gdb, the program fails as soon as I start it: ``` (gdb) r [Thread debugging using libthread_db enabled] Using host libthread_db library

Re: Doubt about char.min/max == typeid(char)

2022-10-06 Thread torhu via Digitalmars-d-learn
On Friday, 7 October 2022 at 00:13:59 UTC, matheus wrote: Hi, Could anyone please tell me why the properties of min/max of a char returns a "char type" and not a value as an int? Well, why whould the highest and lowest values of a type be of a different type..? ```d import std; void

Re: Replacing tango.text.Ascii.isearch

2022-10-06 Thread rassoc via Digitalmars-d-learn
On 10/7/22 01:39, torhu via Digitalmars-d-learn wrote: regex is about ten times faster then. Interesting! Using your code, I'm seeing a 1.5x max difference for ldc, nothing close to 10x. Welp, the woes of superficial benchmarking. :)

Doubt about char.min/max == typeid(char)

2022-10-06 Thread matheus via Digitalmars-d-learn
Hi, Could anyone please tell me why the properties of min/max of a char returns a "char type" and not a value as an int? I just got this while playing around: void main(){ import std.stdio; writeln(char.max); // "nothing" writeln(typeid(char.max)); // "char"

Re: Replacing tango.text.Ascii.isearch

2022-10-06 Thread torhu via Digitalmars-d-learn
On Thursday, 6 October 2022 at 21:36:48 UTC, rassoc wrote: And what kind of testing was that? Mind to share? Because I did the following real quick and wasn't able to measure a "two orders of magnitude" difference. Sure, the regex version came on top, but they were both faster than the ruby

Re: Replacing tango.text.Ascii.isearch

2022-10-06 Thread rassoc via Digitalmars-d-learn
On 10/5/22 23:50, torhu via Digitalmars-d-learn wrote: I did some basic testing, and regex was two orders of magnitude faster. So now I know, I guess. And what kind of testing was that? Mind to share? Because I did the following real quick and wasn't able to measure a "two orders of

Re: Replacing tango.text.Ascii.isearch

2022-10-06 Thread Sergey via Digitalmars-d-learn
On Thursday, 6 October 2022 at 08:15:10 UTC, Siarhei Siamashka wrote: On Wednesday, 5 October 2022 at 21:50:32 UTC, torhu wrote: Please don’t tell us that D will be slower than Python again?)

Re: Is `void` the correct way to say "do not initialize this variable"?

2022-10-06 Thread kdevel via Digitalmars-d-learn
On Monday, 3 October 2022 at 15:56:02 UTC, Paul Backus wrote: Shouldn't this read Unspecified Value: If a void initialized variable's value is used before it is set, its value is unspecified. Yes, it should. Many of the contributors to the D spec are not very well versed in the

Re: What are best practices around toString?

2022-10-06 Thread christian.koestlin via Digitalmars-d-learn
On Saturday, 1 October 2022 at 17:50:54 UTC, tsbockman wrote: On Saturday, 1 October 2022 at 10:02:34 UTC, Salih Dincer wrote: On Saturday, 1 October 2022 at 08:26:43 UTC, tsbockman wrote: `StringBuilder` is a utility shared across the entire project: Appender not good enough; at least in

Re: dub install package globally

2022-10-06 Thread christian.koestlin via Digitalmars-d-learn
On Thursday, 6 October 2022 at 07:06:52 UTC, Preetpal wrote: Is there a way to install packages "globally" using dub? For example, when using the node package manager (NPM) you can install a package "globally" (so it is available for the current user from the command line) using the

Re: Replacing tango.text.Ascii.isearch

2022-10-06 Thread Siarhei Siamashka via Digitalmars-d-learn
On Wednesday, 5 October 2022 at 21:50:32 UTC, torhu wrote: I did some basic testing, and regex was two orders of magnitude faster. So now I know, I guess. Substring search functionality is currently in a very bad shape in Phobos. I discovered this myself a few weeks ago when I was trying to

dub install package globally

2022-10-06 Thread Preetpal via Digitalmars-d-learn
Is there a way to install packages "globally" using dub? For example, when using the node package manager (NPM) you can install a package "globally" (so it is available for the current user from the command line) using the `--global` flag as follows: `npm install --global typescript` This