Re: Possible runtime bug in preprocessing of command line arguments passed to the D main

2021-10-24 Thread Brian Callahan via Digitalmars-d-learn
On Sunday, 24 October 2021 at 14:38:44 UTC, jfondren wrote: With nothing to the contrary, I'd take "must be terminated by a null pointer" as "can't itself be a null pointer". The execve(2) is more explicit: "The argument argv is a pointer to a null-terminated array of character pointers

Re: Possible runtime bug in preprocessing of command line arguments passed to the D main

2021-10-24 Thread Basile B. via Digitalmars-d-learn
On Sunday, 24 October 2021 at 14:38:44 UTC, jfondren wrote: [...] With nothing to the contrary, I'd take "must be terminated by a null pointer" as "can't itself be a null pointer". ah yeah, and thanks, of course ... how would the count of arg be known without the sentinel...

Re: Possible runtime bug in preprocessing of command line arguments passed to the D main

2021-10-24 Thread jfondren via Digitalmars-d-learn
On Sunday, 24 October 2021 at 14:21:52 UTC, Basile B. wrote: What do you think ? I'm very surprised that this is even allowed. Apparently it's Linux userspace that normally complains about it: https://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/progname.c#n54 The manpages just say ```

Re: Possible runtime bug in preprocessing of command line arguments passed to the D main

2021-10-24 Thread Basile B. via Digitalmars-d-learn
On Sunday, 24 October 2021 at 14:21:52 UTC, Basile B. wrote: The following code, on linux [...] What do you think ? Forgot to say that this change ```diff - execv("a", null); + execv("a", ["whatever".ptr].ptr); ``` makes the problem goes away, so it would be caused by how `null` args are

Possible runtime bug in preprocessing of command line arguments passed to the D main

2021-10-24 Thread Basile B. via Digitalmars-d-learn
The following code, on linux ```d module runnable; ​ extern(C) int execv(const char* p, const char** args); ​ immutable src = ` import std.getopt; void main(string[] args) { bool c; getopt(args, "c", ); } `; ​ void prepareProgram() { import std.process :