On 7/26/17 6:01 AM, Timon Gehr wrote:
On 26.07.2017 03:09, Steven Schveighoffer wrote:
On 7/25/17 8:45 PM, Timon Gehr wrote:
...
What Moritz is saying is that the following implementation of fclose is correct according to the C standard:

int fclose(FILE *stream){
     if(stream == NULL){
         return go_wild_and_corrupt_all_the_memory();
     }else{
         return actually_close_the_file(stream);
     }
}

I think we can correctly assume no fclose implementations exist that do anything but access data pointed at by stream. Which means a segfault on every platform we support.

On platforms that may not segfault, you'd be on your own.

In other words, I think we can assume for any C functions that are passed pointers that dereference those pointers, passing null is safely going to segfault.

I'm not going to assume that.

Tell you what, when you find a D platform that this doesn't happen, we can fix it with a version statement ;)

-Steve

Reply via email to