3 ms·
To expand on this, I think the footguns you're talking about are specifically performance related. Just an example: How do you specify a fast readonly array in
by m_mueller 9y ago
To expand on this, I think the footguns you're talking about are specifically performance related.
Just an example: How do you specify a fast readonly array in C? If I recall correctly it's
restrict const * const int my_array[n]
In Fortran?
integer(4), intent(in) :: my_array(n)
Not even starting with array ops, multidimensionals, array slicing etc., that's already a big win in readability. Having a pass-by-reference language by default is refreshing for HPC purposes.
That being said there are disadvantages compared to C. Biggest one IMO is the lack of inline declarations, which especially makes privatizing things in OpenMP and OpenACC code a bit more tricky, i.e. it needs to be explicit.
- smitherfield 9y ago> How do you specify a fast readonly array in C? Generally in the function declaration rather than the variable declaration, but to declare a non-aliasing pointer to array of constant ints would be const int (restrict *my_array)[N]; or int const (*restrict my_array)[N]; and the other two variations thereof.
- int_19h 9y agoGentle reminder to future language designers: whatever else you decide to take from C, please, please don't take declarator syntax. This thread showcases why.