473,748 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

About bitfields


Hi all,

I follow c.l.c. for only a short time and I would like to know
why there isn't anything concerning bitfields among the FAQs.

Is it because ...
1. of portability issues?
2. bitfields aren't enough useful to be discussed?
3. of the low frequency of questions concerning this topic?
4. of anything else?...

Or perhaps it would be interesting to mention bitfields among
the FAQs with a relevant example?

Greetings, Regis
Nov 14 '05 #1
8 1906
On Sat, 14 Feb 2004, Régis Troadec wrote:

Hi all,

I follow c.l.c. for only a short time and I would like to know
why there isn't anything concerning bitfields among the FAQs.

Is it because ...
1. of portability issues?
2. bitfields aren't enough useful to be discussed?
3. of the low frequency of questions concerning this topic?
4. of anything else?...

Or perhaps it would be interesting to mention bitfields among
the FAQs with a relevant example?
FAQ is an acronym for Frequently Asked Questions (or Frequently Answered
Questions). If there is not a common question about bitfields being asked
then there will be no FAQ for them.

Having been in and out of comp.lang.c for the past 15 years and never
remember a specific question about bitfields coming up. So I'm going to go
with option 3 from your list.
Greetings, Regis


--
Send e-mail to: darrell at cs dot toronto dot edu
Don't send e-mail to vi************@ whitehouse.gov
Nov 14 '05 #2
Re'gis Troadec wrote:

Hi all,

I follow c.l.c. for only a short time and I would like to know
why there isn't anything concerning bitfields among the FAQs.

Is it because ...
1. of portability issues?
2. bitfields aren't enough useful to be discussed?
3. of the low frequency of questions concerning this topic?
4. of anything else?...

Or perhaps it would be interesting to mention bitfields among
the FAQs with a relevant example?


The index in the book version says:

bitfields 46-7
and Boolean types 141
portability of 46

Turning to those pages, I find that questions 2.25 and 2.26 are all about
bitfields, and 9.1 references them in a footnote.

Checking these in the online version, I note that questions 2.25 and 2.26
are entirely absent, and that the footnote is absent from 9.1.

My conclusion? Bitfields are a vital aspect of modern C programming, and
Steve Summit ruthlessly exploits this fact for hard-nosed commercial
reasons. This also explains why he's never around comp.lang.c these days -
he's too busy sunning himself on the yacht he bought with the royalties of
the book version of the FAQ.

--
Richard Heathfield : bi****@eton.pow ernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #3
In <Pi************ *************** **@drj.pf> da*****@NOMORES PAMcs.utoronto. ca.com (Darrell Grainger) writes:
On Sat, 14 Feb 2004, R=E9gis Troadec wrote:

I follow c.l.c. for only a short time and I would like to know
why there isn't anything concerning bitfields among the FAQs.

Is it because ...
1. of portability issues?
2. bitfields aren't enough useful to be discussed?
3. of the low frequency of questions concerning this topic?
4. of anything else?...

Or perhaps it would be interesting to mention bitfields among
the FAQs with a relevant example?


FAQ is an acronym for Frequently Asked Questions (or Frequently Answered
Questions). If there is not a common question about bitfields being asked
then there will be no FAQ for them.

Having been in and out of comp.lang.c for the past 15 years and never
remember a specific question about bitfields coming up. So I'm going to go
with option 3 from your list.


It's not as much a matter of frequency (such questions do arise from time
to time) as a matter of those questions not having enough in common to be
worth an entry (or more) in the FAQ.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #4
Richard Heathfield wrote:
Re'gis Troadec wrote:
I follow c.l.c. for only a short time and I would like to know
why there isn't anything concerning bitfields among the FAQs.

Is it because ...
1. of portability issues?
2. bitfields aren't enough useful to be discussed?
3. of the low frequency of questions concerning this topic?
4. of anything else?...

Or perhaps it would be interesting to mention bitfields among
the FAQs with a relevant example?


The index in the book version says:

bitfields 46-7
and Boolean types 141
portability of 46

Turning to those pages, I find that questions 2.25 and 2.26 are
all about bitfields, and 9.1 references them in a footnote.

Checking these in the online version, I note that questions 2.25
and 2.26 are entirely absent, and that the footnote is absent
from 9.1.

My conclusion? Bitfields are a vital aspect of modern C
programming, and Steve Summit ruthlessly exploits this fact for
hard-nosed commercial reasons. This also explains why he's never
around comp.lang.c these days - he's too busy sunning himself on the
yacht he bought with the royalties of the book version of the FAQ.


Well, you should be expert on that facet. Are you having major
problems spending the excess royalties from "C Unleashed"?

Note to OP: The above two (2) paragraphs could use a <sarcasm>
indicator. In practice bitfields are not well suited to portable
programming, due to the lack of standards about them. Masks can
generate portable code.

--
Chuck F (cb********@yah oo.com) (cb********@wor ldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net> USE worldnet address!
Nov 14 '05 #5
CBFalconer wrote:
Richard Heathfield wrote:


<snip>
Bitfields are a vital aspect of modern C
programming, and Steve Summit ruthlessly exploits this fact for
hard-nosed commercial reasons. This also explains why he's never
around comp.lang.c these days - he's too busy sunning himself on the
yacht he bought with the royalties of the book version of the FAQ.


Well, you should be expert on that facet. Are you having major
problems spending the excess royalties from "C Unleashed"?


Yes, I'm afraid so. Let the reader understand.

--
Richard Heathfield : bi****@eton.pow ernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #6
In <40************ **@yahoo.com> CBFalconer <cb********@yah oo.com> writes:
Note to OP: The above two (2) paragraphs could use a <sarcasm>
indicator. In practice bitfields are not well suited to portable
programming, due to the lack of standards about them. Masks can
generate portable code.


Nonsense. Bitfields are perfectly well suited to portable programming:
let the compiler take care of the masking job.

They are not well suited at mapping an externally imposed bit layout,
but the need to do such a thing hardly arises in a portable programming
context. And if it doesn't have to be done portably, it usually can be
done, by observing how the compiler allocates the bit fields.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #7
Dan Pop wrote:
CBFalconer <cb********@yah oo.com> writes:
Note to OP: The above two (2) paragraphs could use a <sarcasm>
indicator. In practice bitfields are not well suited to portable
programming, due to the lack of standards about them. Masks can
generate portable code.


Nonsense. Bitfields are perfectly well suited to portable programming:
let the compiler take care of the masking job.

They are not well suited at mapping an externally imposed bit layout,
but the need to do such a thing hardly arises in a portable programming
context. And if it doesn't have to be done portably, it usually can be
done, by observing how the compiler allocates the bit fields.


In some sense, such as packing, you are correct. However I
conceive of bitfields as more suited to matching imposed
constraints, such as a status word from a peripheral (which is
what you said), and there they may well not even port between
releases of the same compiler.

The user has to know what he is doing in order to use them safely.

--
Chuck F (cb********@yah oo.com) (cb********@wor ldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net> USE worldnet address!
Nov 14 '05 #8
In <40************ ***@yahoo.com> CBFalconer <cb********@yah oo.com> writes:
Dan Pop wrote:
CBFalconer <cb********@yah oo.com> writes:
>Note to OP: The above two (2) paragraphs could use a <sarcasm>
>indicator. In practice bitfields are not well suited to portable
>programming, due to the lack of standards about them. Masks can
>generate portable code.
Nonsense. Bitfields are perfectly well suited to portable programming:
let the compiler take care of the masking job.

They are not well suited at mapping an externally imposed bit layout,
but the need to do such a thing hardly arises in a portable programming
context. And if it doesn't have to be done portably, it usually can be
done, by observing how the compiler allocates the bit fields.


In some sense, such as packing, you are correct. However I
conceive of bitfields as more suited to matching imposed
constraints, such as a status word from a peripheral (which is
what you said), and there they may well not even port between
releases of the same compiler.


In theory. In practice, implementors avoid changing their compilers in
ways that can break existing correct code. Moreover, different
implementors usually adhere to the same set of conventions on the same
platform.
The user has to know what he is doing in order to use them safely.


This is true for each and every feature of the C language.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
412
by: Juha Kettunen | last post by:
Hi I don't know if I am using right words (bit-number), but this is what I mean: You can set a 64 bit number: unsigned long a; Now you can use binary operators to manipulate variable a (for example
0
400
by: tmartsum | last post by:
I have a discussion in comp.std.c++ After a (bit stupid) suggestion on representing a fixed 'big' length int I moderated it to "Bitfields-ints should be allowed to have any fixed length" I got no replys on my moderated suggestion. (I am asking you your opinion of this - I do not really have a C++-problem)
23
2827
by: rohit | last post by:
Hi, In my couple of years of experience, I have never found a single instance where I needed to use unions and bitfields(though I have used structures).I was just imagining where would these find relevance.Though both of these(bitfields and unions) are used where space is a constraint(so I can assume always in embedded systems,where memory is particularly less)and we want to save space/memory. As far as I have read, there is no...
6
2681
by: GalenTX | last post by:
I am looking for opinions on a possible approach to coping with bitfields in a heterogenous environment. We've got a bunch of legacy code which maps to hardware using bitfields. The code was developed for a PowerPC/VxWorks/Tornado enviromant, with the bits packed in a big-endian manner: msb first. We now have to develop an Intel/Windows/MSVC++ version (lsb assigned first) which must maintain compatibility with the hardware interface...
19
14809
by: Mehta Shailendrakumar | last post by:
Hi, I would like to know why array of bitfields is not possible. Is there any relation with processor architecture for this? Thank you for your time. Regards, Shailendra
18
4726
by: richard_l | last post by:
Hello All, I am writing an application which receives a word which is a bitmap. I have created a word typedef which contains a bitfield defining each bit. however, I was wondering however if it would be better to write a macro to access each bit instead of the bitfield. I have read the C-FAQ on bit fields, but was wondering if there were any advantages/disadvantages to using bit shifting. To my mind I think using bitfields are more...
9
19257
by: cman | last post by:
Who can explain to me what bitfields are and how to use them in practice? I would need a fairly detailed explaination, I would be a newbie to advanced C programming features. What are the advantages of using bitfields? cman
10
8498
by: lithiumcat | last post by:
Hi, This question seems to come up quite often, however I haven't managed to find an answer relevant to my case. I often use binary flags, and I have alaways used a "bitmask" technique, that is using #defined or const int powers of two, and using the following primitives : /* declaration and initizalisation of flags */ int flags = 0; /* setting flag */ flags |= FLAG_1;
0
8822
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9359
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9310
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8235
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6792
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6072
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3298
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.