From: "Nate" <nate@uniwest.com>
To: "<Iliyan Malchev>" <ibm@asu.edu>
Cc: linux-gcc@vger.kernel.org
Subject: Re: C Language Reference for @ and :
Date: Wed, 28 Aug 2002 14:09:37 -0700 [thread overview]
Message-ID: <000c01c24ed7$37acc580$5001a8c0@uniwest.com> (raw)
In-Reply-To: Pine.GSO.4.21.0208281355510.20978-100000@general3.asu.edu
I thought that could be the answer on the bit width issue...
I do not know which compiler was being used but I bet you're right because
this code was to compile for a micro-controller. So the output was probably
hex code to download onto the chip. They were probably addresses.
Thank You,
Nate
----- Original Message -----
From: "<Iliyan Malchev>" <ibm@asu.edu>
To: "Nate" <nate@uniwest.com>
Sent: Wednesday, August 28, 2002 2:00 PM
Subject: Re: C Language Reference for @ and :
>
> >
> > I am looking at some C code and I cannot find any language reference as
to
> > what the '@' symbol or token means...
> >
> > For, example, from the header file I am trying to interpret....
> >
> > /////////////////////////////////////////////////////////////////
> > static unsigned char P1 @ 0x90;
> > static unsigned char P2 @ 0xA0;
> > static unsigned char P3 @ 0xB0;
> > /////////////////////////////////////////////////////////////////
> >
>
> The '@' symbol is not standard notation: perhaps the compiler
> you are using has a language extension of some sort.
>
> > /////////////////////////////////////////////////////////////////
> > typedef struct
> > {
> > unsigned B0:1;
> > unsigned B1:1;
> > unsigned B2:1;
> > unsigned B3:1;
> > unsigned B4:1;
> > unsigned B5:1;
> > unsigned B6:1;
> > unsigned B7:1;
> > } SFR;
> > /////////////////////////////////////////////////////////////////
>
> The colon defines the width of the respective field in a number of bits
(that
> is, it defined a bit field). In the example above, you have a structure
where
> each member is one-bit-wide, and the total structure is 8 bits (one
> byte). Thus if you had the following code:
>
> static SFR val; /* set the structure to all zeroes */
>
> ....
>
> val.B5 = 1; /* set the 5th bit */
> fprintf (stdout, "val: %x\n", (unsigned char)val);
>
> will print out the value
>
> val: 20
>
> (binary 0010 0000, the fifth bit was set).
>
>
>
next parent reply other threads:[~2002-08-28 21:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.GSO.4.21.0208281355510.20978-100000@general3.asu.edu>
2002-08-28 21:09 ` Nate [this message]
2002-08-01 7:56 stat() problems Stefanos Koutsoutos
2002-08-01 11:48 ` Alexandre P. Nunes
2002-08-28 20:50 ` C Language Reference for @ and : Nate
2002-08-28 22:16 ` Stephen Satchell
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='000c01c24ed7$37acc580$5001a8c0@uniwest.com' \
--to=nate@uniwest.com \
--cc=ibm@asu.edu \
--cc=linux-gcc@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 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).