I believe many Fortran implementations default to unbuffered io.
Which is probably easy enough to change.
But I think that's really the core issue. Physicists don't want to learn more about programming languages. They want whatever mostly works out of the box and has local documentation and expertise specific to their problem domain.
>Aren't arrays implicitly passed by reference in C also?
He covers that. C passes arrays by reference, but the individual elements aren't contiguous. He says Fortran passes an optimized reference.
That seems to be the context from his example:
for(i = 0; i < nrows; i++){
array[i] = malloc(ncolumns * sizeof(double));
}
I suppose the counterpoint is that he's doing it wrong. But again, maybe physicists just don't want a tool with that much flexibility. double *a = malloc(sizeof(double)*nx*ny*nz);
int id;
for(int k = 0; k < nz; k++) {
for(int j = 0; j < ny; j++) {
for(int i = 0; < i < nx; i++) {
id = k*nx*ny + j*nx + i;
a[id] = /* some mathematical operation */
}
}
}
You can do it in other ways (arrays of pointes, etc), but I think this is probably the simplest conceptually, and the memory is contiguous.Sure, C could make multi-dimensional array handling nicer, but I have macros that basically do his A[x,y,z] for me, admittedly a bit more verbosely.
Many of his points about Fortran are true, but almost all his statements about C are false. Or nearly so, yes, copying an array of floats requires calling a function, memcpy, and not just using an equals sign, but that ain't rough and falls into his idea of "what actually happens ‘under the hood’ inside a computer". And others are easily handled by adopting things like the MKL (want to take the sin of everything in an array, see https://software.intel.com/en-us/mkl-developer-reference-c-t... )
Why would IO be slow in any language? What does the language have to do besides buffering and system calls?
> In Fortran, variables are usually passed by reference, not by value. Under the hood the Fortran compiler automatically optimizes the passing so as to be most efficient.
Aren't arrays implicitly passed by reference in C also?