Re: Unable to open filename passed as command line argument

2020-09-03 Thread Curious via Digitalmars-d-learn
On Thursday, 3 September 2020 at 11:12:49 UTC, user1234 wrote: On Thursday, 3 September 2020 at 10:47:04 UTC, Curious wrote: otherwise what you get as args are D dynamic arrays (a payload made of .ptr and .length) so you can use std.file or std.stdio to open a file using the "D main" arguments

Unable to open filename passed as command line argument

2020-09-03 Thread Curious via Digitalmars-d-learn
Given the following: =a== void main(string[] args) { FILE* fp = fopen(args[1].ptr, "r"); if (!fp) throw new Exception("fopen"); } =b== void main(string[] args) { FILE* fp = fopen(args[1].dup.ptr, "r"); if (!fp) throw new Exception("fopen"); } Why does a fail but

Re: Doubt about compiler: Front-End vs Back-End

2020-02-16 Thread Curious via Digitalmars-d-learn
On Monday, 17 February 2020 at 03:07:33 UTC, Adam D. Ruppe wrote: On Monday, 17 February 2020 at 02:55:56 UTC, Curious wrote: Note the ending: "The same front-end code is used by DMD, GDC and LDC." But what the meaning of this sentence? They literally share like 97% of the code. Looking ove

Doubt about compiler: Front-End vs Back-End

2020-02-16 Thread Curious via Digitalmars-d-learn
Hi, could anyone shed a light about the Frond-End and Back-End? I understood the Back-End part, where "roughly" each compiler will generate a machine code based on a IR (Intermediate Representation) generated by the Front-End. But I'm having trouble with the Front-End part, and for what I ga