9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] pcc limitation?
Date: Sun,  7 Nov 2010 09:46:41 -0500	[thread overview]
Message-ID: <9f6f706b0da2fc0b208ad49c097a823b@brasstown.quanstro.net> (raw)
In-Reply-To: <4CD69C49.5090209@gmx.net>

> writearr should point to a one-member const unsigned char array, and the
> zeroth element of that array has the value JEDEC_WREN.
=
it's not clear to me that c99 allows one to declare an unnamed array
and assign a pointer to it in this way except if the array is a char* or
wchar_t*.

i think the cleanest approach to solving your problem is
to define writeattr as an array, not a uchar*.

- erik

----
8c -FVTw cdha.c
8l -o 8.cdha cdha.8

#include <u.h>
#include <libc.h>

enum{
	Jwren	= 0x06,
};

typedef struct Spicmd Spicmd;
struct Spicmd{
	uchar	writearr[5];
};

void
main(void)
{
	Spicmd cmds[] = {
		{
		.writearr		= {Jwren, },
		},
	};

	print("writearr=%p\n", cmds[0].writearr);
	print("writearr[0]=%#.2hhx\n", cmds[0].writearr[0]);
	exits("");
}



  reply	other threads:[~2010-11-07 14:46 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 [this message]
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

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=9f6f706b0da2fc0b208ad49c097a823b@brasstown.quanstro.net \
    --to=quanstro@quanstro.net \
    --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).