Re: Why many programmers don't like GC?

2021-01-15 Thread welkam via Digitalmars-d-learn
On Friday, 15 January 2021 at 07:35:00 UTC, H. S. Teoh wrote: (1) Refactored one function called from an inner loop to reuse a buffer instead of allocating a new one each time, thus eliminating a large amount of garbage from small allocations; <...> The result was about 40-50% reduction in

Re: Why many programmers don't like GC?

2021-01-15 Thread welkam via Digitalmars-d-learn
On Wednesday, 13 January 2021 at 18:58:56 UTC, Marcone wrote: I've always heard programmers complain about Garbage Collector GC. But I never understood why they complain. What's bad about GC? Most people get to know GC trough Java or C#. Those languages promote the use of OOP and they say

Re: Why many programmers don't like GC?

2021-01-15 Thread welkam via Digitalmars-d-learn
On Friday, 15 January 2021 at 15:18:31 UTC, IGotD- wrote: I have a feeling that bump the pointer is not the complete algorithm that D uses because of that was the only one, D would waste a lot of memory. Freeing memory is for loosers :D https://issues.dlang.org/show_bug.cgi?id=21248 DMD

Re: Why many programmers don't like GC?

2021-01-15 Thread welkam via Digitalmars-d-learn
On Friday, 15 January 2021 at 14:35:55 UTC, Ola Fosheim Grøstad wrote: On Friday, 15 January 2021 at 14:24:40 UTC, welkam wrote: You can use GC with D compiler by passing -lowmem flag. I didnt measure but I heard it can increase compilation time by 3x. Thanks for the info. 3x is a lot Take

Re: Why many programmers don't like GC?

2021-01-15 Thread welkam via Digitalmars-d-learn
On Thursday, 14 January 2021 at 18:51:16 UTC, Ola Fosheim Grøstad wrote: One can follow the same kind of reasoning for D. It makes no sense for people who want to stay high level and do batch programming. Which is why this disconnect exists in the community... I think. The reasoning of why

Re: Why many programmers don't like GC?

2021-01-15 Thread welkam via Digitalmars-d-learn
On Friday, 15 January 2021 at 11:28:55 UTC, Ola Fosheim Grøstad wrote: On Friday, 15 January 2021 at 11:11:14 UTC, Mike Parker wrote: That's the whole point of being able to mix and match. Anyone avoiding the GC completely is missing it (unless they really, really, must be GC-less). Has DMD

Re: Printing shortest decimal form of floating point number with Mir

2021-01-05 Thread welkam via Digitalmars-d-announce
On Tuesday, 5 January 2021 at 21:46:34 UTC, Ola Fosheim Grøstad wrote: On Tuesday, 5 January 2021 at 21:43:09 UTC, welkam wrote: Replace alias Bar(T) = Foo!T; with alias Bar = Foo; struct Foo(T) {} alias Bar = Foo; void f(T)(Bar!T x) {} void main() { auto foo = Bar!int(); f(foo); }

Re: Printing shortest decimal form of floating point number with Mir

2021-01-05 Thread welkam via Digitalmars-d-announce
On Wednesday, 23 December 2020 at 22:13:09 UTC, Ola Fosheim Grøstad wrote: The big picture that the DIP suggested was that when stuff like this fails to compile: struct Foo(T) {} alias Bar(T) = Foo!T; void f(T)(Bar!T x) {} void main() { auto foo = Bar!int(); f(foo); }

Re: Printing shortest decimal form of floating point number with Mir

2021-01-05 Thread welkam via Digitalmars-d-announce
On Tuesday, 5 January 2021 at 15:10:29 UTC, Ola Fosheim Grøstad wrote: On Tuesday, 5 January 2021 at 15:04:34 UTC, welkam wrote: Also how "i'm like you" is an insult? I don't think I should reply to this… Then dont replay to this sentence. My post had more than one sentence. Also the

Re: Printing shortest decimal form of floating point number with Mir

2021-01-05 Thread welkam via Digitalmars-d-announce
On Monday, 4 January 2021 at 22:55:28 UTC, Ola Fosheim Grøstad wrote: It is a name, e.g.: alias BarInt = Bar!int; "BarInt", "Bar!int" and "Foo!int" are all names, or labels, if you wish. And they all refer to the same object: the nominal type. Which you can test easily by using

Re: Printing shortest decimal form of floating point number with Mir

2021-01-04 Thread welkam via Digitalmars-d-announce
On Sunday, 3 January 2021 at 22:50:16 UTC, Ola Fosheim Grøstad wrote: YOU DO HAVE TO ACKNOWLEDGE A TYPE SYSTEM BUG! If an indirection through an alias causes type unification to fail then that is a serious type system failure. No excuses please... Different people have different definitions

Re: Printing shortest decimal form of floating point number with Mir

2021-01-04 Thread welkam via Digitalmars-d-announce
On Monday, 4 January 2021 at 01:19:12 UTC, jmh530 wrote: it makes things overly complicated Just because a feature makes something simpler is not enough of an argument of why it should be added. Case and point C, lua and Go languages. They are popular in part because they are simple. That's

Re: Printing shortest decimal form of floating point number with Mir

2021-01-03 Thread welkam via Digitalmars-d-announce
On Sunday, 3 January 2021 at 06:35:23 UTC, 9il wrote: On Tuesday, 29 December 2020 at 19:59:56 UTC, Ola Fosheim Grøstad wrote: On Tuesday, 29 December 2020 at 16:14:59 UTC, Atila Neves wrote: On Thursday, 24 December 2020 at 14:14:33 UTC, 9il wrote: On Thursday, 24 December 2020 at 14:08:32

Re: Printing shortest decimal form of floating point number with Mir

2020-12-24 Thread welkam via Digitalmars-d-announce
On Wednesday, 23 December 2020 at 18:05:40 UTC, 9il wrote: It was a mockery executed by Atila Read the all comments and didnt saw any mockery

Re: Chimpfella - new library to do benchmarking with ranges (even with templates!)

2020-12-20 Thread welkam via Digitalmars-d-announce
On Saturday, 19 December 2020 at 05:08:56 UTC, Max Haughton wrote: This will soon support Linux's perf_event so you will be able to measure cache misses (and all the other thousands of pmc's intel expose), use LBR msrs etc. Are you going to read stdout from calling perf or are you going to

Re: Talk by Herb Sutter: Bridge to NewThingia

2020-06-29 Thread welkam via Digitalmars-d-announce
On Sunday, 28 June 2020 at 21:00:09 UTC, Dibyendu Majumdar wrote: To be honest the analysis doesn't quite stack up. Because compatibility is not the reason for the success of Go, or Rust. I would say the success of a language depends on many factors: Think of a reasons of why people are

Re: Should a parser type be a struct or class?

2020-06-18 Thread welkam via Digitalmars-d-learn
Oh an also https://github.com/dlang/dmd/pull/9899

Re: Should a parser type be a struct or class?

2020-06-18 Thread welkam via Digitalmars-d-learn
On Wednesday, 17 June 2020 at 14:32:09 UTC, Adam D. Ruppe wrote: On Wednesday, 17 June 2020 at 14:24:01 UTC, Stefan Koch wrote: Parser in dmd does even inherit from Lexer. why would a parser ever inherit from a lexer? So you can write nextToken() instead of lexer.nextToken()

32 bit phobos

2020-06-09 Thread welkam via Digitalmars-d-learn
I tried to compile a 32 bit executable but my system does not have 32 bit phobos. How do I get 32 bit phobos? I am using Manjaro. dmd -m32 source/test2.d /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../libphobos2.a when searching for -lphobos2 /usr/bin/ld:

Re: I want Sublime 3 D auto import !

2020-06-02 Thread welkam via Digitalmars-d-learn
On Tuesday, 2 June 2020 at 06:00:10 UTC, Виталий Фадеев wrote: On Monday, 1 June 2020 at 18:55:03 UTC, Paul Backus wrote: On Monday, 1 June 2020 at 16:18:44 UTC, Виталий Фадеев wrote: I do it! https://github.com/vitalfadeev/SublimeDlangAutoImport Cool. I dont use classe but I see how this

Re: Mir Slice Column or Row Major

2020-05-28 Thread welkam via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 16:53:37 UTC, jmh530 wrote: Not always true...many languages support column-major order (Fortran, most obviously). if your column major matrix is implemented as matrix[row_index][column_index] then ok no puppies will be hurt. But I dont see much value in such

Re: Mir Slice Column or Row Major

2020-05-27 Thread welkam via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 01:31:23 UTC, data pulverizer wrote: column major Cute puppies die when people access their arrays in column major.

Re: How to get the pointer of "this" ?

2020-05-25 Thread welkam via Digitalmars-d-learn
On Sunday, 24 May 2020 at 17:05:16 UTC, Vinod K Chandran wrote: cast(DWORD_PTR) this); Where is DWORD_PTR defined? I cant find it in docs. If its an alias of long then you have to cast to a pointer like this cast(long*) this; you need to specify that you want to cast to a pointer of type T.

Re: Codefence, an embeddable interactive code editor, has added D support.

2020-05-23 Thread welkam via Digitalmars-d-announce
On Saturday, 23 May 2020 at 15:04:35 UTC, Paulo Pinto wrote: Hi everyone, as the subject states, you can find it here, https://codefence.io/ The current version is 2.092.0 with dmd. Regards, Why such thing is free? Who pays for the servers?

Re: How to allocate/free memory under @nogc

2020-05-22 Thread welkam via Digitalmars-d-learn
There is automem to help with manual memory management https://code.dlang.org/packages/automem

Re: How to use this forum ?

2020-05-20 Thread welkam via Digitalmars-d-learn
On Wednesday, 20 May 2020 at 20:49:52 UTC, Vinod K Chandran wrote: Hi all, I have some questions about this forum. 1. How to edit a post ? 2. How to edit a reply ? 3. How to add some code(mostly D code) in posts & replies. 4. How to add an image in posts & replies. 5. Is there a feature to mark

Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler

2020-05-20 Thread welkam via Digitalmars-d-learn
On Wednesday, 20 May 2020 at 18:53:01 UTC, NonNull wrote: Which D compiler should be used to be ABI compatible with mingw32? And which to be ABI compatible with mingw64? I am not expert here but doesnt all C compilers have the same ABI? If yes then compile your code in 32 bits for 32 bit C obj

Re: Is it possible to write some class members in another module ?

2020-05-20 Thread welkam via Digitalmars-d-learn
On Wednesday, 20 May 2020 at 17:29:47 UTC, Vinod K Chandran wrote: I am very sad that i delayed to start learning D only because of semicolons and curly braces. Walter(creator of this language) said that redundant grammar is a good thing because it allows compiler to emit better error

Re: Is it possible to write some class members in another module ?

2020-05-20 Thread welkam via Digitalmars-d-learn
On Wednesday, 20 May 2020 at 09:45:48 UTC, Vinod K Chandran wrote: // Now, we need to use like this auto form= new Window(); form.event.click = bla_bla; // I really want to use like this auto form= new Window(); form.click = bla_bla; ``` Then you want alias this. class Window : Control{

Re: [OT] What do you guys think of dark comedy channel on IT sh.. stuff?

2020-05-19 Thread welkam via Digitalmars-d-announce
On Tuesday, 19 May 2020 at 09:54:38 UTC, Iain Buclaw wrote: Walter raised a pull request to merge the and and and or or AST nodes into a logical logical operator, and the initial rebuttal was that he's used log log for and and or or or operators for a very (very) long time. Now this is gold.

Re: Pijamas, a simple fluent assertation library (forked from Pyjamas)

2020-05-15 Thread welkam via Digitalmars-d-announce
On Friday, 15 May 2020 at 14:42:47 UTC, Dmitry Olshansky wrote: compiler usually explodes trying to swallow it https://media.giphy.com/media/tfxgAK370HzEY/giphy.gif

Re: "Programming in D" on Educative.io

2020-05-15 Thread welkam via Digitalmars-d-announce
On Thursday, 14 May 2020 at 08:42:43 UTC, ShadoLight wrote: On Wednesday, 13 May 2020 at 19:25:43 UTC, welkam wrote: On Thursday, 7 May 2020 at 09:18:04 UTC, Ali Çehreli wrote: Because D is a re-engineering of C++ I thought it was re-engineering of C This opinion seems quite common in the

Re: "Programming in D" on Educative.io

2020-05-13 Thread welkam via Digitalmars-d-announce
On Thursday, 7 May 2020 at 09:18:04 UTC, Ali Çehreli wrote: Because D is a re-engineering of C++ I thought it was re-engineering of C

Re: Beginner's Comparison Benchmark

2020-05-06 Thread welkam via Digitalmars-d-learn
On Tuesday, 5 May 2020 at 20:29:13 UTC, Steven Schveighoffer wrote: the optimizer recognizes what you are doing and changes your code to: writeln(1_000_000_001); Oh yes a classic constant folding. The other thing to worry about is dead code elimination. Walter has a nice story where he sent

Re: $750 Bounty: Issue 16416 - Phobos std.uni out of date (should be updated to latest Unicode standard)

2020-05-04 Thread welkam via Digitalmars-d-announce
On Monday, 4 May 2020 at 17:30:41 UTC, Arine wrote: On Monday, 4 May 2020 at 17:01:01 UTC, Robert M. Münch wrote: Besides getting the work done, there is one constraint: The work needs to get into Phobos. It doesn't make sense to have it sit around, because it's not being merged. I don't have

Re: How can I open a Binary EXE with Hexadecimal?

2020-05-02 Thread welkam via Digitalmars-d-learn
On Saturday, 2 May 2020 at 21:05:32 UTC, Baby Beaker wrote: I need open a Binary EXE, it can be using "rb" mode and convert it to Hexadecimal for me make some changes and save as "rb" again. How can I make it? Thank you. You dont convert binary data to hexadecimal. You display it as

Re: Hunt Framework 3.0.0 Released, Web Framework for DLang!

2020-05-01 Thread welkam via Digitalmars-d-announce
On Friday, 1 May 2020 at 16:32:27 UTC, Heromyth wrote: On Friday, 1 May 2020 at 13:11:23 UTC, welkam wrote: On Friday, 1 May 2020 at 10:54:55 UTC, zoujiaqing wrote: <...> I did a quick look and it looks like http server + some goodies. Is this a correct assessment? If yes what is the status

Re: Hunt Framework 3.0.0 Released, Web Framework for DLang!

2020-05-01 Thread welkam via Digitalmars-d-announce
On Friday, 1 May 2020 at 10:54:55 UTC, zoujiaqing wrote: <...> I did a quick look and it looks like http server + some goodies. Is this a correct assessment? If yes what is the status of http 2.0, ssl and bzip support?

Re: Newbie linker errors - still missing _fltused _tls_index _tls_used localtime tzset mainCRTStartup

2020-04-26 Thread welkam via Digitalmars-d-learn
If I remember correctly VS studio has different release and debug configurations for both compiler and linker. If release works but debug doesnt make sure that when you add things to one to also add to another

Re: DConf 2020 Canceled

2020-03-15 Thread welkam via Digitalmars-d-announce
On Sunday, 8 March 2020 at 03:56:35 UTC, Era Scarecrow wrote: From what i've researched, it's more or less the flu... a somewhat more contagious, over-hyped, genetically modified, potentially respiratory infection cold/flu; And likely a tool by government(s) to force unwanted policies down

Re: Using shared memory and thread

2019-11-05 Thread welkam via Digitalmars-d-learn
On Monday, 4 November 2019 at 19:53:29 UTC, bioinfornatics wrote: 3/ variable flagged as `shared` does at mean the variable is put into L2 cache ? First caching is controlled by CPU not programmer. Second not all architectures share L2 between cores. 4 jaguar cores share L2 cache in consoles

Re: Eliding of slice range checking

2019-10-25 Thread welkam via Digitalmars-d-learn
On Thursday, 24 October 2019 at 21:02:03 UTC, Per Nordlöw wrote: On Thursday, 24 October 2019 at 18:37:05 UTC, welkam wrote: I remember in some video Chandler Carruth said that value range propagation across function boundary was implemented in llvm but later removed because it produced no

Re: Eliding of slice range checking

2019-10-24 Thread welkam via Digitalmars-d-learn
On Wednesday, 23 October 2019 at 11:20:59 UTC, Per Nordlöw wrote: Does DMD/LDC avoid range-checking in slice-expressions such as the one in my array-overload of `startsWith` defined as bool startsWith(T)(scope const(T)[] haystack, scope const(T)[] needle) { if

Re: Remove unwanted ' \r ' from an Array ... by reading a *.txt file.

2019-10-24 Thread welkam via Digitalmars-d-learn
On Thursday, 24 October 2019 at 16:49:09 UTC, Mil58 wrote: On Thursday, 24 October 2019 at 16:21:47 UTC, welkam wrote: On Thursday, 24 October 2019 at 15:27:05 UTC, Mil58 wrote: [...] void main() { File("data.txt", "r+") .byLineCopy() .array() .each!writeln; }

Re: [DTrace probe] is there a [portable] way to add section to elf executable?

2019-10-24 Thread welkam via Digitalmars-d-learn
On Wednesday, 23 October 2019 at 15:24:13 UTC, drug wrote: I'd like to add (and modify) section to ELF executable to implement DTrace probes. DTrace does it in probe assembly: ``` __asm__ __volatile__ ( "990: nop .pushsection .note.stapsdt,\"?\",\"note\" .balign 4

Re: dub build doesn't work

2019-10-24 Thread welkam via Digitalmars-d-learn
On Thursday, 24 October 2019 at 01:17:24 UTC, OiseuKodeur wrote: BTW if you prefer using optlink and the digitalmars C runtime, you can instruct dub to do so with: --arch=x86 how can i add --arch=x86 flag to the dub.json so it do it automatically ? "dflags": [ "--arch=x86" ]

Re: Converting a ulong to a byte array and constructing a ulong from it

2019-10-24 Thread welkam via Digitalmars-d-learn
On Thursday, 24 October 2019 at 14:08:36 UTC, 9898287 wrote: Does this contain any undefined behavior? It is in C as far as I knew. immutable int number = 1; auto bad_idea = (cast(ubyte*) )[0 .. number.sizeof]; bad_idea[0] = 2; writeln(number); //1 writeln(*(cast(int*)bad_idea.ptr)); //2 Cast

Re: Remove unwanted ' \r ' from an Array ... by reading a *.txt file.

2019-10-24 Thread welkam via Digitalmars-d-learn
On Thursday, 24 October 2019 at 15:27:05 UTC, Mil58 wrote: Hi all It's me again ;-) (because you're very strong in Dlang, here...) In want a result as i write in a comment, with remove unwanted '\r' >> import std.stdio; import std.file; import std.conv; import std.process : executeShell; /*

Re: utiliD: A library with absolutely no dependencies for bare-metal programming and bootstrapping other D libraries

2019-05-20 Thread welkam via Digitalmars-d-announce
On Friday, 10 May 2019 at 23:51:56 UTC, H. S. Teoh wrote: Libc implementations of fundamental operations, esp. memcpy, are usually optimized to next > week and back for the target architecture, taking advantage of the target arch's quirks to > maximize performance Yeah about that... Level1

Re: My Meeting C++ Keynote video is now available

2019-01-15 Thread welkam via Digitalmars-d-announce
On Tuesday, 15 January 2019 at 11:59:58 UTC, Atila Neves wrote: He's not saying "kill classes in D", he's saying an OOP system in D could be implemented from primitives and classes don't need to be a language feature, similar to CLOS in Common Lisp. For some people writing OOP means writing

Re: DLP identify leaf functions

2018-12-11 Thread welkam via Digitalmars-d-announce
On Tuesday, 4 December 2018 at 11:02:11 UTC, Jacob Carlborg wrote: On 2018-12-02 17:57, welkam wrote: What a timing. I am working on (slowly) on a tool that would get all struct and class declarations and for each of them get functions in which they are used. Then combine them with profiling

Re: D compilation is too slow and I am forking the compiler

2018-12-11 Thread welkam via Digitalmars-d-announce
On Friday, 23 November 2018 at 16:21:53 UTC, welkam wrote: If you want to read data from that bool CPU needs to fetch 8 bytes of data(cache line of 64 bits). What this means is that for one bit of information CPU fetches 64 bits of data resulting in 1/64 = 0.015625 or ~1.6 % signal to noise

Re: DLP identify leaf functions

2018-12-02 Thread welkam via Digitalmars-d-announce
On Friday, 30 November 2018 at 20:10:05 UTC, Jacob Carlborg wrote: I would like to announce a new project I've started, called DLP (D Language Processing). Currently it's quite experimental but the idea is that it would contain a collection of commands for inspecting D code in various ways. It

Re: gcc 9 vs. dmd?

2018-11-30 Thread welkam via Digitalmars-d-learn
On Friday, 30 November 2018 at 04:47:26 UTC, Andrew Pennebaker wrote: gcc is currently required for dmd on FreeBSD, as dmd links to libstdc++. Parts of dmd are still written in C++ but most of it was converted recently. More on that here: "DMD backend now in D"

Re: D is supposed to compile fast.

2018-11-26 Thread welkam via Digitalmars-d-learn
On Sunday, 25 November 2018 at 22:00:21 UTC, Chris Katko wrote:. So 1) I have to compile manually, then link. Except that also runs the files every time even if they're up-to-date. Is that normal behavior for C/C++? Well you dont have to use separate commands but yes compiling and linking

Re: D is supposed to compile fast.

2018-11-24 Thread welkam via Digitalmars-d-learn
On Friday, 23 November 2018 at 08:57:57 UTC, Chris Katko wrote: D is supposed to compile fast. You didnt read the fine print. It compiles simple code fast. Also compilation is separate step from linking and your program might spend half of "compilation" time in link phase.

Re: D compilation is too slow and I am forking the compiler

2018-11-23 Thread welkam via Digitalmars-d-announce
On Friday, 23 November 2018 at 19:21:03 UTC, Walter Bright wrote: On 11/23/2018 5:23 AM, welkam wrote: Currently D reads the all files that are passed in command line before starting lexing/parsing, but in principle we could start lexing/parsing after first file is read. In fact we could

Re: D compilation is too slow and I am forking the compiler

2018-11-23 Thread welkam via Digitalmars-d-announce
On Friday, 23 November 2018 at 14:32:39 UTC, Vladimir Panteleev wrote: On Friday, 23 November 2018 at 13:23:22 UTC, welkam wrote: If we run these steps in different thread on the same core with SMT we could better use core`s resources. Reading file with kernel, decoding UTF-8 with vector

Re: D compilation is too slow and I am forking the compiler

2018-11-23 Thread welkam via Digitalmars-d-announce
On Thursday, 22 November 2018 at 04:48:09 UTC, Vladimir Panteleev wrote: Sorry about that. I'll have to think of two titles next time, one for the D community and one for everyone else. If it's of any consolation, the top comments in both discussion threads point out that the title is

Re: D compilation is too slow and I am forking the compiler

2018-11-23 Thread welkam via Digitalmars-d-announce
On Wednesday, 21 November 2018 at 10:56:02 UTC, Walter Bright wrote: Wouldn't it be awesome to have the lexing/parsing of the imports all done in parallel? From my testing lexing/parsing takes small amount of build time so running it in parallel might be small gain. We should consider

Re: Why does nobody seem to think that `null` is a serious problem in D?

2018-11-21 Thread welkam via Digitalmars-d-learn
On Wednesday, 21 November 2018 at 09:20:01 UTC, NoMoreBugs wrote: On Tuesday, 20 November 2018 at 15:46:35 UTC, Adam D. Ruppe wrote: On Tuesday, 20 November 2018 at 13:27:28 UTC, welkam wrote: Because the more you learn about D the less you want to use classes. classes rock. You just

Re: Why does nobody seem to think that `null` is a serious problem in D?

2018-11-20 Thread welkam via Digitalmars-d-learn
On Monday, 19 November 2018 at 21:23:31 UTC, Jordi Gutiérrez Hermoso wrote: Why does nobody seem to think that `null` is a serious problem in D? Because the more you learn about D the less you want to use classes. I view class as compatibility feature when you want to port Java code to D.

Re: What is best way to read and interpret binary files?

2018-11-20 Thread welkam via Digitalmars-d-learn
On Tuesday, 20 November 2018 at 12:01:49 UTC, Stanislav Blinov wrote: On Tuesday, 20 November 2018 at 11:54:59 UTC, welkam wrote: On Monday, 19 November 2018 at 22:14:25 UTC, Neia Neutuladh wrote: Nothing stops you from writing: SomeStruct myStruct;

Re: What is best way to read and interpret binary files?

2018-11-20 Thread welkam via Digitalmars-d-learn
On Monday, 19 November 2018 at 22:14:25 UTC, Neia Neutuladh wrote: Nothing stops you from writing: SomeStruct myStruct; fd.rawRead((cast(ubyte*))[0..SomeStruct.sizeof]); Standard caveats about byte order and alignment. Never would I thought about casting struct to static array. If I

What is best way to read and interpret binary files?

2018-11-19 Thread welkam via Digitalmars-d-learn
So my question is in subject/title. I want to parse binary file into D structs and cant really find any good way of doing it. What I try to do now is something like this byte[4] fake_integer; auto fd = File("binary.data", "r"); fd.rawRead(fake_integer); int real_integer = *(cast(int*)

Re: Profiling DMD's Compilation Time with dmdprof

2018-11-17 Thread welkam via Digitalmars-d-announce
On Saturday, 17 November 2018 at 12:36:30 UTC, rikki cattermole wrote: Just in case, did you disable your anti-virus first? Had to edit registry to turn that thing off and it still some times popup. Microsoft is so annoying. https://imgur.com/a/x3cKjZm

Re: Profiling DMD's Compilation Time with dmdprof

2018-11-17 Thread welkam via Digitalmars-d-announce
I just updated DMD on my windows and tried to compile hello world. It took 7.4 sec. Something is not right. Can anyone reproduce? On the same mashine running linux it compiles and runs in 0.1 sec PS C:\Users\Welkam\Desktop\Projects> Measure-Command {dmd -run main.d} Days : 0

Re: Backend nearly entirely converted to D

2018-11-08 Thread welkam via Digitalmars-d-announce
On Thursday, 8 November 2018 at 18:52:02 UTC, H. S. Teoh wrote: length is getting ridiculous Having better editor support is nice but by "use better editor" you meant use vim dont you? And even if I switch to vim it wont solve my initial objection to one letter variable names. Its needless

Re: Backend nearly entirely converted to D

2018-11-08 Thread welkam via Digitalmars-d-announce
On Thursday, 8 November 2018 at 18:15:55 UTC, Stanislav Blinov wrote: One keystroke (well ok, two keys because it's *) ;) https://dl.dropbox.com/s/mifou0ervwspx5i/vimhl.png What sorcery is this? I need to know. I guess its vim but how does it highlight symbols?

Re: Backend nearly entirely converted to D

2018-11-08 Thread welkam via Digitalmars-d-announce
On Wednesday, 7 November 2018 at 22:08:36 UTC, H. S. Teoh wrote: I don't speak for the compiler devs, but IMO, one-letter variables are OK if they are local, and cover a relatively small scope. By saying more descriptive I should have clarified that I meant to change them to 3-7 letter

Re: Backend nearly entirely converted to D

2018-11-08 Thread welkam via Digitalmars-d-announce
On Wednesday, 7 November 2018 at 22:03:20 UTC, Walter Bright wrote: Single letter names are appropriate for locally defined symbols. There's also an informal naming convention for them, changing the names would disrupt that. And where can i read about naming convention? My guess its not

Re: Profiling DMD's Compilation Time with dmdprof

2018-11-08 Thread welkam via Digitalmars-d-announce
On Tuesday, 6 November 2018 at 19:01:58 UTC, H. S. Teoh wrote: It looks like it would be really useful one day when I try to tackle the dmd-on-lowmem-system problem again. Based on my profiling it seems that most memory is allocated in void importAll(Scope* sc) found in attrib.d . A person

Re: Backend nearly entirely converted to D

2018-11-07 Thread welkam via Digitalmars-d-announce
On Wednesday, 7 November 2018 at 00:01:13 UTC, Walter Bright wrote: On 11/6/2018 3:00 PM, H. S. Teoh wrote: What sort of refactoring are we looking at? Any low-hanging fruit here that we non-compiler-experts can chip away at? Simply going with foreach loops is a nice improvement. Thas

Re: Backend nearly entirely converted to D

2018-11-07 Thread welkam via Digitalmars-d-announce
On Wednesday, 7 November 2018 at 14:39:55 UTC, Joakim wrote: I don't know why you think that would matter: I'm using the same compilers to build each DMD version and comparing the build times as the backend was translated to D What did you compared is whether clang or DMD compiles code

Re: D T-Shirts

2018-10-21 Thread welkam via Digitalmars-d
On Sunday, 21 October 2018 at 20:04:02 UTC, Fleel wrote: It would be awesome if there were T-Shirts with D-man on them. I would totally buy one, and would help to support the foundation too... well that cost 100$+

Re: Can opApply be made @nogc?

2018-10-21 Thread welkam via Digitalmars-d-learn
DIP 1000 says: Delegates currently defensively allocate closures with the GC. Few actually escape, and with scope only those that actually escape need to have the closures allocated. https://github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md#benefits

Re: D Binding to GUI libraries [was Interesting Observation from JAXLondon]

2018-10-21 Thread welkam via Digitalmars-d
On Saturday, 20 October 2018 at 16:37:07 UTC, Atila Neves wrote: I've also realised that there are parts of C++ that are probably unstranslatable no matter what I do. This can be solved with good gui. It need to look like meld on linux where original cpp and translated d files are side by

Re: Truly @nogc Exceptions?

2018-10-21 Thread welkam via Digitalmars-d
On Thursday, 20 September 2018 at 10:48:35 UTC, Atila Neves wrote: What's the fix? Have the compiler insert a call to the exception's destructor at the end of the `catch(scope Exception)` block. If I understood you correctly then we have same idea. If exception is not handled or re thrown

Re: My statements related to terminating my SAoC relationship

2018-10-17 Thread welkam via Digitalmars-d
On Monday, 15 October 2018 at 21:26:52 UTC, solidstate1991 wrote: my sleep disorder became even worse. I started to sleep 10-12 hours a day while spending around 4-6 hours in bed just to trying to fall asleep And when you wake up do you feel rested and fully awake or does it take time to

Re: A Friendly Challenge for D

2018-10-16 Thread welkam via Digitalmars-d
On Tuesday, 16 October 2018 at 20:58:54 UTC, Jabari Zakiya wrote: And they could be modded to catch semantics like this and produce faster code. Its hard to prove that you will only write 1 or 0 in the array and even if you write such pass it wont fire very often. So slower compile times for

Re: No D bindings in Atom editor

2018-10-16 Thread welkam via Digitalmars-d
On Tuesday, 16 October 2018 at 17:48:42 UTC, Jabari Zakiya wrote: On Tuesday, 16 October 2018 at 02:34:47 UTC, Jabari Zakiya wrote: Just updated Atom editor and noticed D files read as plain .txt and no D bindings in list of programs. Maybe someone should bring that to Atom's devs attention.

Re: A Friendly Challenge for D

2018-10-16 Thread welkam via Digitalmars-d
On Tuesday, 16 October 2018 at 17:57:23 UTC, Jabari Zakiya wrote: This is the exact same behavior I found with the Nim compiler too. Well Nim compiler is more like translator. It translates Nim code to c or c++. Since gcc was responsible for optimizations and instruction selection it would

Re: A Friendly Challenge for D

2018-10-16 Thread welkam via Digitalmars-d
So I run profiler and 97% of time is spent in void twinsSieve function and hotspots are seg[k] = seg[k] | 1; lines. Since seg[k] can only be 1 or 0 I removed that or operation. And the results are. Queue the drum-roll... 5% slower. I thought that all of my studying was getting somewhere.

Re: A Friendly Challenge for D

2018-10-13 Thread welkam via Digitalmars-d
On Saturday, 13 October 2018 at 09:22:16 UTC, Vijay Nayar wrote: I downloaded the reference NIM implementation and got the latest nim compiler, but I received the following error: $ nim c --cc:gcc --d:release --threads:on twinprimes_ssoz.nim twinprimes_ssoz.nim(74, 11) Error: attempting

Re: You don't like GC? Do you?

2018-10-12 Thread welkam via Digitalmars-d
On Friday, 12 October 2018 at 20:12:26 UTC, Stanislav Blinov wrote: Saying stuff like "do more with GC" is just outright harmful. Kids are reading, for crying out loud. People in this thread mostly said that for some things GC is just awesome. When you need to get shit done fast and dirty GC

Re: A Friendly Challenge for D

2018-10-12 Thread welkam via Digitalmars-d
On Friday, 12 October 2018 at 16:19:59 UTC, Jabari Zakiya wrote: The real point of the challenge is too see what idiomatic code... There is no idiomatic D code. There is only better implementations. D doesnt tell you how to write your code. It gives you many tools and you choose which

Re: A Friendly Challenge for D

2018-10-12 Thread welkam via Digitalmars-d
On Friday, 12 October 2018 at 16:19:59 UTC, Jabari Zakiya wrote: Hmm,I don't think what you're saying about similar output|performance with other languages is empirically correct, but it's really not the point of the challenge. Thats why godbolt exists. c++ and Rust

Re: A Friendly Challenge for D

2018-10-12 Thread welkam via Digitalmars-d
On Wednesday, 10 October 2018 at 16:15:56 UTC, Jabari Zakiya wrote: What I am requesting here is for a person(s) who is an "expert" (very good) to create a very fast D version, using whatever tricks it has to maximize performance. I would like to include in my paper a good comparison of

Re: What does -vtls compiler flag does and ...

2018-10-04 Thread welkam via Digitalmars-d-learn
On Wednesday, 3 October 2018 at 21:50:49 UTC, Stanislav Blinov wrote: Thread-local storage is memory allocated for each thread. Only static non-immutable variables go there. Regular variables on the stack aren't explicitly placed in any TLS, they're, well, on the stack as it is. Oh so its

Re: What does -vtls compiler flag does and ...

2018-10-03 Thread welkam via Digitalmars-d-learn
string a = "test"; is a variable that mutates so it should be thread local. Also ASM output shows that these variables are not optimized away so compiler should output something but it doesnt. Or I dont understand thread local storage.

Re: What does -vtls compiler flag does and ...

2018-10-03 Thread welkam via Digitalmars-d-learn
On Wednesday, 3 October 2018 at 20:58:01 UTC, Stanislav Blinov wrote: No, all *static non-immutable* variables are thread-local by default, not just "all variables". I misspoke but this should write something https://run.dlang.io/is/3u1wFp If you look at asm output there are "call

What does -vtls compiler flag does and ...

2018-10-03 Thread welkam via Digitalmars-d-learn
I was playing around with dmd`s make file trying to see if I can compile dmd with different compilers and different compilation flags. By playing around I found that some dmd files are compiled with -vtls flag unconditionally and that ldc do not support this flag. First I dont know what -vtls

Re: Jai compiles 80,000 lines of code in under a second

2018-09-21 Thread welkam via Digitalmars-d
On Thursday, 20 September 2018 at 23:13:38 UTC, aliak wrote: And is there anyway to get even near the performance of Jai when it comes to compilations I watched the same video today. What a coincidence. In Jai example 80 000 lines of "code" include comments and empty lines. Since we know

Re: Dub, Cargo, Go, Gradle, Maven

2018-02-13 Thread welkam via Digitalmars-d
ADG? Google doesnt find anything relevant

Re: Old but interesting link as to the low adoption reason for D

2018-02-13 Thread welkam via Digitalmars-d
On Monday, 12 February 2018 at 22:10:49 UTC, Bo wrote: * Lack of default OFFICIAL libraries like HTTP(s), database access, ... Why there should be one default OFFICIAL library for anything? Writing libraries is about choosing between different tradeoffs so no library satisfy all use cases.

Re: My choice to pick Go over D ( and Rust ), mostly non-technical

2018-02-05 Thread welkam via Digitalmars-d
On Monday, 5 February 2018 at 20:12:09 UTC, Walter Bright wrote: much of it seems to be a replacement for the inline assembler, and D has a nice inline assembler. Inline assembler is not portable and limits optimizing compilers ability to optimize your code. Also assembler is bad at

Re: My choice to pick Go over D ( and Rust ), mostly non-technical

2018-02-05 Thread welkam via Digitalmars-d
On Monday, 5 February 2018 at 22:02:09 UTC, Boris-Barboris wrote: "Here is a one-liner wich may make your condition statements faster, if you use it right. There is PGO (Profile Guided Optimization) that can do that without additional language extensions. You need to find better example to

Re: NES emulator written in D

2018-02-04 Thread welkam via Digitalmars-d-announce
On Sunday, 4 February 2018 at 20:56:32 UTC, blahness wrote: 2. DMD just doesn't produce fast code compared to other modern compilers. It's a shame LDC or GDC isn't the default D compiler. For the core team improving DMD codegen is not a priority

Re: My choice to pick Go over D ( and Rust ), mostly non-technical

2018-02-04 Thread welkam via Digitalmars-d
On Sunday, 4 February 2018 at 22:05:45 UTC, Dgame wrote: I want to use a language and if I see problems which are ignored I move on. That is how it is, no offense. So you see a problem and do not work on fixing it then complain that other people do the same. Ok.

Re: NES emulator written in D

2018-02-04 Thread welkam via Digitalmars-d-announce
Could you share your experience with us? How it compares to go implementation? Did D made it harder or easier to implement emulator?

  1   2   >