Re: Regarding assignment to struct

Liste des GroupesRevenir à cl c 
Sujet : Re: Regarding assignment to struct
De : gazelle (at) *nospam* shell.xmission.com (Kenny McCormack)
Groupes : comp.lang.c
Date : 04. May 2025, 10:25:08
Autres entêtes
Organisation : The official candy of the new Millennium
Message-ID : <vv7bpk$2n9mf$1@news.xmission.com>
References : 1 2 3 4
User-Agent : trn 4.0-test77 (Sep 1, 2010)
In article <vv6ng8$1410m$1@dont-email.me>,
James Kuyper  <jameskuyper@alumni.caltech.edu> wrote:
...
The fact that an implementation does not have to do the equivalent of
memcpy() to perform a struct copy means that successful assignment
cannot be checked by using memcmp().

Which then begs two questions:

    1) Why wouldn't an implementaton do it with memcpy()?  That is likely
    to be as good or better than any other method, including, especially, a
    member-by-member copy.

    2) Why wouldn't you, the programmer, just use memcpy() instead of
    struct assignment?  Yes, I realize there are other cases to consider,
    but in the simple one:

    struct something foo,bar;
foo = bar;

    memcpy() seems like it would always be easier and more reliable.

--
The randomly chosen signature file that would have appeared here is more than 4
lines long.  As such, it violates one or more Usenet RFCs.  In order to remain
in compliance with said RFCs, the actual sig can be found at the following URL:
http://user.xmission.com/~gazelle/Sigs/Pedantic

Date Sujet#  Auteur
2 May 25 * Regarding assignment to struct84Lew Pitcher
2 May 25 +- Re: Regarding assignment to struct1Keith Thompson
2 May 25 +* Re: Regarding assignment to struct13Barry Schwarz
2 May 25 i`* That depends... (Was: Regarding assignment to struct)12Kenny McCormack
3 May 25 i `* Re: That depends... (Was: Regarding assignment to struct)11Lew Pitcher
3 May 25 i  +- Re: That depends... (Was: Regarding assignment to struct)1Lawrence D'Oliveiro
3 May 25 i  +- Re: That depends... (Was: Regarding assignment to struct)1Janis Papanagnou
3 May 25 i  +* Re: That depends... (Was: Regarding assignment to struct)5Kaz Kylheku
3 May 25 i  i+* Re: That depends... (Was: Regarding assignment to struct)3Kaz Kylheku
5 May 25 i  ii`* Re: That depends... (Was: Regarding assignment to struct)2Janis Papanagnou
5 May 25 i  ii `- Re: That depends... (Was: Regarding assignment to struct)1Kaz Kylheku
4 May 25 i  i`- Re: That depends... (Was: Regarding assignment to struct)1Tim Rentsch
3 May 25 i  +- Re: That depends... (Was: Regarding assignment to struct)1James Kuyper
4 May 25 i  `* Re: That depends... (Was: Regarding assignment to struct)2Tim Rentsch
4 May 25 i   `- Re: That depends... (Was: Regarding assignment to struct)1Lew Pitcher
2 May 25 +* Re: Regarding assignment to struct2Waldek Hebisch
3 May 25 i`- Re: Regarding assignment to struct1Lew Pitcher
3 May 25 +* Re: Regarding assignment to struct51Andrey Tarasevich
3 May 25 i+* Re: Regarding assignment to struct9Lawrence D'Oliveiro
4 May 25 ii`* Re: Regarding assignment to struct8Keith Thompson
4 May 25 ii `* Re: Regarding assignment to struct7James Kuyper
4 May 25 ii  +- Re: Regarding assignment to struct1Kenny McCormack
4 May 25 ii  +- Re: Regarding assignment to struct1David Brown
4 May 25 ii  `* Re: Regarding assignment to struct4Keith Thompson
5 May 25 ii   +- Re: Regarding assignment to struct1James Kuyper
5 May 25 ii   +- Re: Regarding assignment to struct1Keith Thompson
6 May 25 ii   `- Re: Regarding assignment to struct1Tim Rentsch
3 May 25 i+- Re: Regarding assignment to struct1Lawrence D'Oliveiro
4 May 25 i`* Re: Regarding assignment to struct40Tim Rentsch
5 May 25 i `* Re: Regarding assignment to struct39Andrey Tarasevich
5 May 25 i  +* Re: Regarding assignment to struct16Michael S
5 May 25 i  i+* Re: Regarding assignment to struct14Andrey Tarasevich
5 May 25 i  ii`* Re: Regarding assignment to struct13Michael S
5 May 25 i  ii +- Re: Regarding assignment to struct1Tim Rentsch
5 May 25 i  ii `* Re: Regarding assignment to struct11Andrey Tarasevich
5 May 25 i  ii  +* Re: Regarding assignment to struct2Michael S
6 May 25 i  ii  i`- Re: Regarding assignment to struct1Tim Rentsch
5 May 25 i  ii  `* Re: Regarding assignment to struct8Keith Thompson
6 May 25 i  ii   +* Re: Regarding assignment to struct2Tim Rentsch
6 May 25 i  ii   i`- Re: Regarding assignment to struct1Keith Thompson
6 May 25 i  ii   +- Re: Regarding assignment to struct1David Brown
6 May 25 i  ii   `* Re: Regarding assignment to struct4Waldek Hebisch
6 May 25 i  ii    +* Re: Regarding assignment to struct2David Brown
7 May 25 i  ii    i`- Re: Regarding assignment to struct1David Brown
6 May 25 i  ii    `- Re: Regarding assignment to struct1Keith Thompson
5 May 25 i  i`- Re: Regarding assignment to struct1Tim Rentsch
5 May 25 i  +* Re: Regarding assignment to struct4Keith Thompson
5 May 25 i  i`* Re: Regarding assignment to struct3Andrey Tarasevich
8 May 25 i  i `* Re: Regarding assignment to struct2Tim Rentsch
8 May 25 i  i  `- Re: Regarding assignment to struct1David Brown
5 May 25 i  +* Re: Regarding assignment to struct15Keith Thompson
5 May 25 i  i+* Re: Regarding assignment to struct6Michael S
5 May 25 i  ii+- Re: Regarding assignment to struct1Kenny McCormack
5 May 25 i  ii+* Re: Regarding assignment to struct3Keith Thompson
5 May 25 i  iii`* Re: Regarding assignment to struct2Kaz Kylheku
6 May 25 i  iii `- Re: Regarding assignment to struct1Tim Rentsch
6 May 25 i  ii`- Re: Regarding assignment to struct1Tim Rentsch
5 May 25 i  i`* Re: Regarding assignment to struct8Tim Rentsch
5 May 25 i  i `* Re: Regarding assignment to struct7Keith Thompson
6 May 25 i  i  `* Re: Regarding assignment to struct6Nick Bowler
6 May 25 i  i   `* Re: Regarding assignment to struct5Keith Thompson
7 May 25 i  i    `* Re: Regarding assignment to struct4Nick Bowler
7 May 25 i  i     +* Re: Regarding assignment to struct2Keith Thompson
8 May 25 i  i     i`- Re: Regarding assignment to struct1Nick Bowler
8 May 25 i  i     `- Re: Regarding assignment to struct1Tim Rentsch
5 May 25 i  +* Re: Regarding assignment to struct2Tim Rentsch
5 May 25 i  i`- Re: Regarding assignment to struct1David Brown
12 May 25 i  `- Re: Regarding assignment to struct1NotAorB
3 May 25 +* Re: Regarding assignment to struct8David Brown
5 May 25 i`* Re: Regarding assignment to struct7Muttley
5 May 25 i +- Re: Regarding assignment to struct1David Brown
5 May 25 i `* Re: Regarding assignment to struct5Keith Thompson
6 May 25 i  +- Re: Regarding assignment to struct1Muttley
6 May 25 i  +* Re: Regarding assignment to struct2David Brown
6 May 25 i  i`- Re: Regarding assignment to struct1Muttley
6 May 25 i  `- Re: Regarding assignment to struct1Michael S
4 May 25 +* Re: Regarding assignment to struct6Richard Damon
4 May 25 i`* Re: Regarding assignment to struct5Michael S
4 May 25 i +* Re: Regarding assignment to struct2Lawrence D'Oliveiro
4 May 25 i i`- Re: Regarding assignment to struct1David Brown
6 May 25 i +- Re: Regarding assignment to struct1Tim Rentsch
12 May 25 i `- Re: Regarding assignment to struct1Rosario19
4 May 25 +- Re: Regarding assignment to struct1Tim Rentsch
4 May 25 `- Re: Regarding assignment to struct1Keith Thompson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal