From: Christoph Bussenius <busseniu@cip.physik.uni-muenchen.de>
To: linux-c-programming@vger.kernel.org
Subject: Re: Initializer element is not constant
Date: Sat, 22 Jan 2005 22:12:06 +0100 [thread overview]
Message-ID: <20050122211206.GC12029@opaque> (raw)
In-Reply-To: <20050121213157.GC977@drmemory.local>
Hi Scott,
On Fri, Jan 21, 2005 at 02:31:57PM -0700, Scott wrote:
> recip_data[0].var = namectrl;
namectrl is NULL, so why would you want to do this? This is just like
writing
recip_data[0] = NULL;
I am not quite sure what you intend to do, but I guess that you want
namectrl to change when you change recip_data[0]. To accomplish this,
you could make recip_data[0] a pointer to a pointer:
char *namectrl = NULL;
char *name1 = NULL;
char *name2 = NULL;
typedef struct {
char **var; /* destination for storage of the data */
size_t len; /* max len of the data */
char *(*xlat)(); /* translation routine */
} DATUM;
DATUM recip_data[] = {
{ &namectrl, NAMECTRL_LEN, make_upper },
{ &name1, NAME1_LEN, make_upper },
{ &name2, NAME2_LEN, make_upper },
[...]
Now you can change namectrl by saying
*recip_data[0].var = "test string";
Hope this helps,
Christoph
--
``There's no dark side of the moon, really
Matter of fact, it's all dark''
--Pink Floyd
next prev parent reply other threads:[~2005-01-22 21:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-20 23:21 Initializer element is not constant Scott
[not found] ` <41F06AC1.2000605@hq.ntsp.nec.co.jp>
2005-01-21 2:37 ` Ron Michael Khu
2005-01-21 16:27 ` Scott
2005-01-21 17:46 ` Ron Michael Khu
2005-01-21 18:54 ` Scott
2005-01-21 19:50 ` Ron Michael Khu
2005-01-21 21:31 ` Scott
2005-01-22 21:12 ` Christoph Bussenius [this message]
2005-01-24 20:44 ` Scott
-- strict thread matches above, loose matches on Subject: below --
2005-01-24 21:09 Huber, George K RDECOM CERDEC STCD SRI
2005-01-24 21:28 ` Scott
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050122211206.GC12029@opaque \
--to=busseniu@cip.physik.uni-muenchen.de \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.