Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > regarding bit field structures

Reply
Thread Tools

regarding bit field structures

 
 
sushant
Guest
Posts: n/a
 
      01-19-2005
is it possible to scan a value to a member of a stucture which is of
bit field type??? if yes then how if no then why....

 
Reply With Quote
 
 
 
 
Eric Sosman
Guest
Posts: n/a
 
      01-19-2005
sushant wrote:

> is it possible to scan a value to a member of a stucture which is of
> bit field type??? if yes then how if no then why....


If by "scan the value" you mean "read it using one of
the scanf() family of functions," the answer is no: it is
not possible.

"Why" is a question with a few layers of answers, the
topmost being that bit fields are not addressable; it is
not possible to form a pointer to a bit field. To the
next layer's "Why," the answer is that `char' is the "atom"
in C's addressing model; since a bit field may be smaller
than a `char' or may straddle `char' boundaries, C's model
of addresses cannot accommodate it. Still further levels of
"Why" stray into the realm of computer architecture design,
which I'm not qualified to discuss -- and besides, it's a
topic for some other newsgroup.

--
Eric Sosman
http://www.velocityreviews.com/forums/(E-Mail Removed)lid
 
Reply With Quote
 
 
 
 
Richard Bos
Guest
Posts: n/a
 
      01-19-2005
"sushant" <(E-Mail Removed)> wrote:

> is it possible to scan a value to a member of a stucture which is of
> bit field type??? if yes then how if no then why....


What do you mean by "scan"? If you mean read the value of and use it in
an expression, then yes, in the obvious way.

Richard
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the point of having 16 bit colour if a computer monitor can only display 8 bit colour? How do you edit 16 bit colour when you can only see 8 bit? Scotius Digital Photography 6 07-13-2010 03:33 AM
Bit field structures and C++ Marcel Müller C++ 4 10-21-2008 08:28 AM
structures, structures and more structures (questions about nestedstructures) Alfonso Morra C Programming 11 09-24-2005 07:42 PM
64 bit - Windows Liberty 64bit, Windows Limited Edition 64 Bit, Microsoft SQL Server 2000 Developer Edition 64 Bit, IBM DB2 64 bit - new ! vvcd Computer Support 0 09-17-2004 08:15 PM
64 bit - Windows Liberty 64bit, Windows Limited Edition 64 Bit,Microsoft SQL Server 2000 Developer Edition 64 Bit, IBM DB2 64 bit - new! Ionizer Computer Support 1 01-01-2004 07:27 PM



Advertisments