473,466 Members | 1,508 Online
Bytes | Software Development & Data Engineering Community
Create 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 1890
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.powernet.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*****@NOMORESPAMcs.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********@yahoo.com) (cb********@worldnet.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.powernet.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********@yahoo.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********@yahoo.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********@yahoo.com) (cb********@worldnet.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********@yahoo.com> writes:
Dan Pop wrote:
CBFalconer <cb********@yahoo.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
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...
0
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...
23
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...
6
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...
19
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
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...
9
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...
10
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
1
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...
0
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,...
0
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...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...

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.