On 11/7/19 7:57 PM, Segher Boessenkool wrote:
Hi!

On Thu, Nov 07, 2019 at 06:44:17PM +0100, Egeyar Bagcioglu wrote:
On 11/7/19 9:03 AM, Segher Boessenkool wrote:
+       ASM_OUTPUT_ASCII(asm_out_file, cmdline, cmdline_length);
+    }
+  cmdline[0] = 0;
+  ASM_OUTPUT_ASCII(asm_out_file, cmdline, 1);
+
+  /* The return value is currently ignored by the caller, but must be 0.
*/
+  return 0;
+}
A temporary file like this isn't so great.
GCC operates with temporary files, doesn't it? What is the concern that
is specific to this one? That is the most reasonable way I found to pass
the argv of gcc to child processes for saving. Other ways of passing it
that I could think of, or the idea of saving it in the driver were
actually very bad ideas.
Oh, this is for passing something to another process?  I guess I didn't
read it closely enough, sorry, never mind.

Opening a file as "r" but then
accessing it with "fread" is peculiar, too.
I am not sure what you mean here. Is it that you prefer "wb" and "rb"
instead of "w" and "r"? I thought it was enough to use a consistent pair.
I'd use fgets or similar, not fread.

Two things made me prefer fread over fgets here:
1) Although I am reading a string, I do not need each read character to be checked against newline. I just need to read till end-of-file. 2) fread returns the number of elements read which I later use. If I used fgets, I'd need to call strlen or so afterwards to get the string size.

Let me know please if you disagree or if there are advantages / disadvantages that I omit.

Regards
Egeyar

Reply via email to