473,466 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how much memory does this consume...

4 New Member
I would like to know how much memory does the following declatations consume?

Expand|Select|Wrap|Line Numbers
  1. typedef struct
  2. {
  3.   unsigned int type:2;
  4.   unsigned int Specific:1;
  5.   unsigned int direction:1;
  6.   unsigned int Rsp:1;
  7.   unsigned int reserved:3;
  8. } Control_t;
  9.  
  10. Control_t Control; //What would be the memory consumption for this
  11.  
1. Will the memory consumption be 1 byte? if so how will the bits be assigned?
I mean will the type variable ocupy the 2bits of Least significant position...
2. How will the bits be assigned?

Thanks all in advance
Jun 26 '09 #1
1 2685
JosAH
11,448 Recognized Expert MVP
Two quotes from the C Standard:

A bit-field may have type int , unsigned int , or signed int .
Whether the high-order bit position of a ``plain'' int bit-field is
treated as a sign bit is implementation-defined. A bit-field is
interpreted as an integral type consisting of the specified number of
bits.

An implementation may allocate any addressable storage unit large
enough to hold a bit-field. If enough space remains, a bit-field that
immediately follows another bit-field in a structure shall be packed
into adjacent bits of the same unit. If insufficient space remains,
whether a bit-field that does not fit is put into the next unit or
overlaps adjacent units is implementation-defined. The order of
allocation of bit-fields within a unit (high-order to low-order or
low-order to high-order) is implementation-defined. The alignment of
the addressable storage unit is unspecified.
and another one:

The expression that specifies the width of a bit-field shall be an
integral constant expression that has nonnegative value that shall not
exceed the number of bits in an ordinary object of compatible type.
If the value is zero, the declaration shall have no declarator.
kind regards,

Jos
Jun 26 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: atalukdar1 | last post by:
Hi , I am facing performance problem in oracle , my oracle8.1.6 in solaris 8 consume 89 to 91% memory when i see from prstat -t command, can anybody help me out to do some tuning so that i...
2
by: assi | last post by:
Hello all We are developing a large dotnet application, which includes ~ 120 assemblies. (total size of all binaries is ~ 20MB). Our application also references the following dotnet assemblies:...
6
by: Andrzej | last post by:
Used to read newsgroup for answers, now have to ask for them as well. I have an application (C#, .NET 1.1) that connects to local db on MSDE 2000 SP3a (using ADO from MDAC 2.71) on one side and...
2
by: Roshawn Dawson | last post by:
Hi All, I have an xml file that is 63mb in size. If I were to load this file into memory, will it consume 63mb of memory or will it consume more than that? Thanks, Roshawn
8
by: lurker | last post by:
If a compiled exe project is under 400kb, why does it take up 15Mb when running? Is this normal? If not, how do I restrict the amount of memory it can consume? Secondly, does anyone have a bit...
0
by: Tomas | last post by:
I have two questions: (1) How (if possible) can you, with ASP.NET (and with the IIS 5 included with win2000) specify an maximum limit of the memory that a web application may consume, as an...
16
by: JCauble | last post by:
We have a large Asp.net application that is currently crashing our production servers. What we are seeing is the aspnet_wp eat up a bunch of memory and then stop unexpectedly. Does not recycle. ...
9
by: Bruno Barberi Gnecco | last post by:
I'm using PHP to run a CLI application. It's a script run by cron that parses some HTML files (with DOM XML), and I ended up using PHP to integrate with the rest of the code that already runs the...
2
by: ksrashmi | last post by:
Hi , does jar file loaidng will consume the jvm memory ? I have to run the cronjobs for some of the java files . so i have writen the .sh file ( linux server) ...
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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: 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: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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.