Sujet : Re: That depends... (Was: Regarding assignment to struct)
De : lew.pitcher (at) *nospam* digitalfreehold.ca (Lew Pitcher)
Groupes : comp.lang.cDate : 03. May 2025, 02:13:48
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vv3qkc$2b7nd$1@dont-email.me>
References : 1 2 3
User-Agent : Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)
On Fri, 02 May 2025 20:44:45 +0000, Kenny McCormack wrote:
In article <51ba1k5h5lkj75qvfuj0ferlddpb6bi0n8@4ax.com>,
Barry Schwarz <schwarzb@delq.com> wrote:
...
Wouldn't it be quicker and easier to write a simple program to test
this rather than wait for someone to compose a response? You already
have 90% of the code written.
That depends on what the actual personal goal is.
Somehow, I don' think Lew's goal(s) (and reason for posting) are what you
think they are.
My goal is to add a feature to one of my older programs. The feature will
require passing a number of objects down and up the function call chain, and
I'm looking at various alternatives to accomplish this.
ATM, it looks like I either go with "global" objects, or I change the
argument list of several functions to include about 5 more objects each.
Because these additional objects all relate to one another, I'm thinking
of grouping them in a struct, and passing a pointer to the struct back
and forth.
But... I remembered this (apparently) seldom-used feature of being able
to pass a struct by value up and down the chain (down, as a function
argument, up as a function return value). As I've not done this before,
and I've not /seen/ it done in other peoples code, I wonder how viable
a solution it might be.
If it is legal, then why isn't it used more often? Is it a readability/
maintainability issue, or is it something else?
-- Lew Pitcher"In Skills We Trust"