| Deutsch English Français Italiano |
|
<86plgo7ahu.fsf@linuxsc.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch <tr.17687@z991.linuxsc.com> Newsgroups: comp.lang.c Subject: Re: Regarding assignment to struct Date: Sun, 04 May 2025 06:48:13 -0700 Organization: A noiseless patient Spider Lines: 30 Message-ID: <86plgo7ahu.fsf@linuxsc.com> References: <vv338b$16oam$1@dont-email.me> <vv4j9p$33vhj$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Sun, 04 May 2025 15:48:21 +0200 (CEST) Injection-Info: dont-email.me; posting-host="f2e2a4892b4200c8deca4768c4473856"; logging-data="2179137"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Bv82AUM8fa/fM6Qn4CIWj2jQWr+ctqvk=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:oUpdlXpE4yEMLFtnM88j9aV9uqs= sha1:TS1M8ukEPhaYvsGrM/Ald39BIf8= Andrey Tarasevich <noone@noone.net> writes: > On Fri 5/2/2025 11:34 AM, Lew Pitcher wrote: > >> Back in the days of K&R, Kernighan and Ritchie published an addendum >> to the "C Reference Manual" titled "Recent Changes to C" (November 1978) >> in which they detailed some differences in the C language post "The >> C Programming Language". >> >> The first difference they noted was that >> "Structures may be assigned, passed as arguments to functions, and >> returned by functions." >> >> From what I can see of the ISO C standards, the current C language >> has kept these these features. However, I don't see many C projects >> using them. > > Weird. Virtually every C project relies on assignment of > structures. Passing-returning structs by value might be more rare > (although perfectly valid and often appropriate too), but > assignment... assignment is used by everyone everywhere without even > giving it a second thought. > > One dark corner this feature has, is that in C (as opposed to C++) the > result of an assignment operator is an rvalue, which can easily lead > to some interesting consequences related to structs with arrays > inside. I'm curious to know what interesting consequences you mean here. Do you mean something other than cases that have undefined behavior?