Liste des Groupes | Revenir à co vms |
On 8/21/2024 8:26 AM, chrisq wrote:On 8/21/24 02:25, Lawrence D'Oliveiro wrote:In C one should definitely return a pointer to struct and notOn Tue, 20 Aug 2024 09:47:36 -0400, Arne Vajhøj wrote:>Few languages support multiple return values.>
Even in C and Fortran, a function can return a struct.
Better to declare the struct externally, then pass a pointer
to it. Much tidier.
a struct.
It looks like VSI Fortran cannot return a structure as function
result, but VSI Pascal can return a record as function result.
And it is returned as a pointer argument under the hood.
$ type s.pas
module s;
type
iiituple = record
a : integer;
b : integer;
c : integer;
end;
[global]
function get : iiituple;
void get(struct iiituple *res);Note that C follow the same convention, so:
int main()
{
struct iiituple res;
get(&res);
Les messages affichés proviennent d'usenet.