Re: New VSI post on Youtube

Liste des GroupesRevenir à co vms 
Sujet : Re: New VSI post on Youtube
De : arne (at) *nospam* vajhoej.dk (Arne Vajhøj)
Groupes : comp.os.vms
Date : 23. Aug 2024, 18:03:44
Autres entêtes
Organisation : SunSITE.dk - Supporting Open source
Message-ID : <66c8c0f0$0$705$14726298@news.sunsite.dk>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
User-Agent : Mozilla Thunderbird
On 8/23/2024 9:02 AM, Arne Vajhøj wrote:
On 8/23/2024 4:14 AM, Michael S wrote:
                    and that the best option in C is the same
as in many other languages - return the structure itself.
 Returning the struct itself result in a copy of the struct. The
time to do the copy is probably insignificant though.

I am not quite convinced yet.
It seems like one frequently provided reason for using pointer
is ABI compatibility.
I don't know about that. It is not that easy to create the
problem.
But it is possible:
$ type i.h
struct data
{
     int a;
     int b;
#ifdef NEWVERSION
     int c;
#endif
};
$ type s1.c
#include "i.h"
struct data get()
{
     struct data res;
     res.a = 123;
     res.b = 456;
#ifdef NEWVERSION
     res.c = 0x7FFFFFFF;
#endif
     return res;
}
$ type m1.c
#include <stdio.h>
#include  "i.h"
struct data get();
int main()
{
     struct data res = get();
     printf("%d %d\n", res.a, res.b);
     return 0;
}
$ type s2.c
#include <stdlib.h>
#include "i.h"
struct data *get()
{
     struct data *res = malloc(sizeof(struct data));
     res->a = 123;
     res->b = 456;
#ifdef NEWVERSION
     res->c = 0x7FFFFFFF;
#endif
     return res;
}
$ type m2.c
#include <stdio.h>
#include <stdlib.h>
#include  "i.h"
struct data *get();
int main()
{
     struct data *res = get();
     printf("%d %d\n", res->a, res->b);
     free(res);
     return 0;
}
$ cc s1
$ cc m1
$ link m1 + s1
$ run m1
123 456
$ cc/define="NEWVERSION" s1
$ link m1 + s1
$ run m1
99108 0
$ cc s2
$ cc m2
$ link m2 + s2
$ run m2
123 456
$ cc/define="NEWVERSION" s2
$ link m2 + s2
$ run m2
123 456
Arne

Date Sujet#  Auteur
13 Aug 24 * New VSI post on Youtube208Arne Vajhøj
14 Aug 24 `* Re: New VSI post on Youtube207Arne Vajhøj
14 Aug 24  `* Re: New VSI post on Youtube206Simon Clubley
14 Aug 24   +* Re: New VSI post on Youtube184Robert A. Brooks
14 Aug 24   i+* Re: New VSI post on Youtube180Arne Vajhøj
14 Aug 24   ii+* Re: New VSI post on Youtube22Robert A. Brooks
14 Aug 24   iii`* Re: New VSI post on Youtube21Arne Vajhøj
14 Aug 24   iii `* Re: New VSI post on Youtube20Robert A. Brooks
14 Aug 24   iii  +- Re: New VSI post on Youtube1Arne Vajhøj
15 Aug 24   iii  +* Re: New VSI post on Youtube8Stephen Hoffman
15 Aug 24   iii  i`* Re: New VSI post on Youtube7Craig A. Berry
16 Aug 24   iii  i `* Re: New VSI post on Youtube6Stephen Hoffman
17 Aug 24   iii  i  `* Re: New VSI post on Youtube5Lawrence D'Oliveiro
17 Aug 24   iii  i   `* Re: New VSI post on Youtube4Craig A. Berry
17 Aug 24   iii  i    `* Re: New VSI post on Youtube3Lawrence D'Oliveiro
18 Aug 24   iii  i     `* Re: New VSI post on Youtube2Arne Vajhøj
18 Aug 24   iii  i      `- Re: New VSI post on Youtube1Lawrence D'Oliveiro
16 Aug 24   iii  `* Re: New VSI post on Youtube10John Dallman
16 Aug 24   iii   +* Re: New VSI post on Youtube2Arne Vajhøj
17 Aug 24   iii   i`- Re: New VSI post on Youtube1Lawrence D'Oliveiro
17 Aug 24   iii   +- Re: New VSI post on Youtube1Craig A. Berry
19 Aug 24   iii   `* Re: New VSI post on Youtube6Simon Clubley
19 Aug 24   iii    `* Re: New VSI post on Youtube5Arne Vajhøj
20 Aug 24   iii     `* Re: New VSI post on Youtube4Simon Clubley
20 Aug 24   iii      +- Re: New VSI post on Youtube1Arne Vajhøj
23 Aug 24   iii      `* Re: New VSI post on Youtube2Stephen Hoffman
23 Aug 24   iii       `- Re: New VSI post on Youtube1Lawrence D'Oliveiro
14 Aug 24   ii+* Re: New VSI post on Youtube149Arne Vajhøj
15 Aug 24   iii+- Re: C and C++ and Deprecation (was: Re: New VSI post on Youtube)1Stephen Hoffman
15 Aug 24   iii+* Re: New VSI post on Youtube146Simon Clubley
15 Aug 24   iiii+- Re: New VSI post on Youtube1Arne Vajhøj
15 Aug 24   iiii+- Re: New VSI post on Youtube1Arne Vajhøj
19 Aug 24   iiii`* Re: New VSI post on Youtube143chrisq
19 Aug 24   iiii +* Re: New VSI post on Youtube91Arne Vajhøj
20 Aug 24   iiii i+- Re: New VSI post on Youtube1Lawrence D'Oliveiro
20 Aug 24   iiii i+* Re: New VSI post on Youtube73chrisq
20 Aug 24   iiii ii`* Re: New VSI post on Youtube72Simon Clubley
20 Aug 24   iiii ii +* Re: New VSI post on Youtube4chrisq
21 Aug 24   iiii ii i`* Re: New VSI post on Youtube3Lawrence D'Oliveiro
21 Aug 24   iiii ii i `* Re: New VSI post on Youtube2Arne Vajhøj
21 Aug 24   iiii ii i  `- Re: New VSI post on Youtube1Lawrence D'Oliveiro
20 Aug 24   iiii ii +* Re: New VSI post on Youtube49Arne Vajhøj
21 Aug 24   iiii ii i+* Re: New VSI post on Youtube20Lawrence D'Oliveiro
21 Aug 24   iiii ii ii+* Re: New VSI post on Youtube6Arne Vajhøj
21 Aug 24   iiii ii iii+* Re: New VSI post on Youtube3Lawrence D'Oliveiro
21 Aug 24   iiii ii iiii+- Re: New VSI post on Youtube1Arne Vajhøj
22 Aug 24   iiii ii iiii`- Re: New VSI post on Youtube1Dave Froble
22 Aug 24   iiii ii iii`* Re: New VSI post on Youtube2Dave Froble
22 Aug 24   iiii ii iii `- Re: New VSI post on Youtube1Arne Vajhøj
21 Aug 24   iiii ii ii`* Re: New VSI post on Youtube13chrisq
21 Aug 24   iiii ii ii +* Re: New VSI post on Youtube11Arne Vajhøj
21 Aug 24   iiii ii ii i+- Re: New VSI post on Youtube1Arne Vajhøj
22 Aug 24   iiii ii ii i+- Re: New VSI post on Youtube1Arne Vajhøj
23 Aug 24   iiii ii ii i`* Re: New VSI post on Youtube8chrisq
23 Aug 24   iiii ii ii i +* Re: New VSI post on Youtube6Arne Vajhøj
23 Aug 24   iiii ii ii i i`* Re: New VSI post on Youtube5Michael S
23 Aug 24   iiii ii ii i i +* Re: New VSI post on Youtube2Arne Vajhøj
23 Aug 24   iiii ii ii i i i`- Re: New VSI post on Youtube1Arne Vajhøj
27 Aug 24   iiii ii ii i i `* VSI Forums offline ?2babydr DBA James W. Laferriere
27 Aug 24   iiii ii ii i i  `- Re: VSI Forums offline ?1Arne Vajhøj
23 Aug 24   iiii ii ii i `- Re: New VSI post on Youtube1Lawrence D'Oliveiro
22 Aug 24   iiii ii ii `- Re: New VSI post on Youtube1Lawrence D'Oliveiro
24 Aug 24   iiii ii i+* Re: New VSI post on Youtube27Lars Poulsen
24 Aug 24   iiii ii ii+* Re: New VSI post on Youtube24Lawrence D'Oliveiro
25 Aug 24   iiii ii iii+* Re: New VSI post on Youtube11Arne Vajhøj
25 Aug 24   iiii ii iiii`* Re: New VSI post on Youtube10Lawrence D'Oliveiro
25 Aug 24   iiii ii iiii `* Re: New VSI post on Youtube9Arne Vajhøj
25 Aug 24   iiii ii iiii  `* Re: New VSI post on Youtube8Lawrence D'Oliveiro
25 Aug 24   iiii ii iiii   `* Re: New VSI post on Youtube7Arne Vajhøj
26 Aug 24   iiii ii iiii    `* Re: New VSI post on Youtube6Lawrence D'Oliveiro
26 Aug 24   iiii ii iiii     `* Re: New VSI post on Youtube5Arne Vajhøj
26 Aug 24   iiii ii iiii      +- Re: New VSI post on Youtube1Lawrence D'Oliveiro
27 Aug 24   iiii ii iiii      `* Re: New VSI post on Youtube3Arne Vajhøj
27 Aug 24   iiii ii iiii       +- Re: New VSI post on Youtube1Arne Vajhøj
27 Aug 24   iiii ii iiii       `- Re: New VSI post on Youtube1Lawrence D'Oliveiro
27 Aug 24   iiii ii iii+- Re: New VSI post on Youtube1Simon Clubley
27 Aug 24   iiii ii iii`* Re: New VSI post on Youtube11John Dallman
27 Aug 24   iiii ii iii `* Re: New VSI post on Youtube10Lawrence D'Oliveiro
28 Aug 24   iiii ii iii  +* Re: New VSI post on Youtube2Arne Vajhøj
28 Aug 24   iiii ii iii  i`- Re: New VSI post on Youtube1Lawrence D'Oliveiro
28 Aug 24   iiii ii iii  +* Re: New VSI post on Youtube2Arne Vajhøj
28 Aug 24   iiii ii iii  i`- Re: New VSI post on Youtube1Lawrence D'Oliveiro
28 Aug 24   iiii ii iii  `* Re: New VSI post on Youtube5John Dallman
29 Aug 24   iiii ii iii   `* Re: New VSI post on Youtube4Lawrence D'Oliveiro
29 Aug 24   iiii ii iii    `* Re: New VSI post on Youtube3Craig A. Berry
29 Aug 24   iiii ii iii     +- Re: New VSI post on Youtube1Arne Vajhøj
30 Aug 24   iiii ii iii     `- Re: New VSI post on Youtube1Lawrence D'Oliveiro
24 Aug 24   iiii ii ii`* Re: New VSI post on Youtube2Craig A. Berry
25 Aug 24   iiii ii ii `- Re: New VSI post on Youtube1Lawrence D'Oliveiro
25 Aug 24   iiii ii i`- Re: New VSI post on Youtube1Dan Cross
20 Aug 24   iiii ii +- Re: New VSI post on Youtube1Single Stage to Orbit
20 Aug 24   iiii ii +* Re: New VSI post on Youtube9bill
20 Aug 24   iiii ii i+* Re: New VSI post on Youtube3Simon Clubley
22 Aug 24   iiii ii ii`* Re: New VSI post on Youtube2Dave Froble
22 Aug 24   iiii ii ii `- Re: New VSI post on Youtube1Arne Vajhøj
20 Aug 24   iiii ii i+- Re: New VSI post on Youtube1Arne Vajhøj
22 Aug 24   iiii ii i`* Re: New VSI post on Youtube4Dave Froble
22 Aug 24   iiii ii i `* Re: New VSI post on Youtube3Simon Clubley
22 Aug 24   iiii ii i  +- Re: New VSI post on Youtube1Arne Vajhøj
23 Aug 24   iiii ii i  `- Re: New VSI post on Youtube1Dave Froble
22 Aug 24   iiii ii +* Re: New VSI post on Youtube2Dave Froble
25 Aug 24   iiii ii `* Re: New VSI post on Youtube6Stephen Hoffman
20 Aug 24   iiii i`* Re: New VSI post on Youtube16Simon Clubley
19 Aug 24   iiii +* Re: C and C++, promotion, stabilization, migration (was: Re: New VSI post on Youtube)50Stephen Hoffman
20 Aug 24   iiii `- Re: New VSI post on Youtube1Simon Clubley
19 Aug 24   iii`- Re: New VSI post on Youtube1chrisq
14 Aug 24   ii+* Re: New VSI post on Youtube2Arne Vajhøj
15 Aug 24   ii`* Re: New VSI post on Youtube6Lawrence D'Oliveiro
15 Aug 24   i`* Re: New VSI post on Youtube3John Dallman
14 Aug 24   `* Re: New VSI post on Youtube21Arne Vajhøj

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal