|
[Sponsors] |
[FORTRAN] - equivalent to sqort() and realloc() in C? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 23, 2021, 04:08 |
[FORTRAN] - equivalent to sqort() and realloc() in C?
|
#1 |
Senior Member
Gerry Kan
Join Date: May 2016
Posts: 362
Rep Power: 11 |
Howdy Folks:
I am wondering if there are standardized (i.e., portable) equivalent functions in Fortran (90/'03) that serve similar functions in C: qsort() - I know there is a qsort subroutine, but I don't know if it is a standard subroutine across all Fortran compilers realloc() - I seem to have problem looking for a Fortran equivalent. The workaround is to use temporary storage. Thanks very much in advance, Gerry. |
|
February 23, 2021, 06:07 |
|
#2 |
Senior Member
|
The answer to both is no, there aren't portable equivalents (i.e., intrinsic functions from the standard). The closer you can get to realloc (that I am aware of) is with the following:
Code:
allocate(a, source=[b,c]) |
|
February 24, 2021, 12:09 |
|
#3 |
Senior Member
Gerry Kan
Join Date: May 2016
Posts: 362
Rep Power: 11 |
Paolo:
Thanks. I ended up writing them both from scratch. It is a pity that there is not really something like (void *) that will let me write my sort implementation with any data type in mind. Gerry. |
|
|
|