From: Russ Cox <rsc@swtch.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] pcc limitation?
Date: Sun, 7 Nov 2010 21:58:04 -0500 [thread overview]
Message-ID: <AANLkTi=6gGWX5u-c30aP5OoMMoRO2R5ZdYqpL-6dv8QL@mail.gmail.com> (raw)
In-Reply-To: <4CD6D235.3030704@gmx.net>
> That solution wastes variables and is generally pretty ugly.
> I still hope we can find a better solution.
You can't. C doesn't work that way.
Your choices are to use a fixed-size array or to
declare helper arrays as you have already done.
You can use string literals as aliases for helper
arrays, but that's probably even worse.
#define JEDEC_WREN "\x06"
#define JEDEC_SE "\x20"
... cmds[] = {
{ .writearr = (uchar*)(JEDEC_WREN) },
{ .writearr = (uchar*)(JEDEC_SE "\x01\x23\x45") },
...
}
If that's enough to turn your stomach, then your
only remaining alternative is to write a program to
generate the code for you using helper arrays.
Russ
prev parent reply other threads:[~2010-11-08 2:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-07 0:56 Carl-Daniel Hailfinger
2010-11-07 4:02 ` Federico G. Benavento
2010-11-07 12:32 ` Carl-Daniel Hailfinger
2010-11-07 14:46 ` erik quanstrom
2010-11-07 16:22 ` Carl-Daniel Hailfinger
2010-11-07 18:26 ` erik quanstrom
2010-11-07 19:36 ` Carl-Daniel Hailfinger
2010-11-07 19:42 ` erik quanstrom
2010-11-08 0:16 ` Carl-Daniel Hailfinger
2010-11-08 0:56 ` erik quanstrom
2010-11-08 9:39 ` Julius Schmidt
2010-11-08 14:00 ` erik quanstrom
2010-11-08 15:17 ` Anthony Sorace
2010-11-08 2:58 ` Russ Cox [this message]
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='AANLkTi=6gGWX5u-c30aP5OoMMoRO2R5ZdYqpL-6dv8QL@mail.gmail.com' \
--to=rsc@swtch.com \
--cc=9fans@9fans.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).