473,411 Members | 2,019 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Does C# support struct bit definitions?


Hi,
Does C# support struct bit definitions. For example is there a way to
declare somethink like this C/C++ Code:

struct CELL { // Declare CELL bit field
unsigned short character : 8; // 00000000 ????????
unsigned short foreground : 3; // 00000??? 00000000
unsigned short intensity : 1; // 0000?000 00000000
unsigned short background : 3; // 0???0000 00000000
unsigned short blink : 1; // ?0000000 00000000
} screen;

I looked through the MSDN and I think that it's not possible. So this
post it's to know if I'm correct or dead wrong.

Thanks
Cláudio Albuquerque

Jul 18 '06 #1
2 1954
<sy******@gmail.comwrote in message
news:11**********************@s13g2000cwa.googlegr oups.com...
I looked through the MSDN and I think that it's not possible. So this
post it's to know if I'm correct or dead wrong.
You could simulate the same thing with properties.

Michael
Jul 18 '06 #2
sy******@gmail.com wrote:
Hi,
Does C# support struct bit definitions. For example is there a way to
declare somethink like this C/C++ Code:

struct CELL { // Declare CELL bit field
unsigned short character : 8; // 00000000 ????????
unsigned short foreground : 3; // 00000??? 00000000
unsigned short intensity : 1; // 0000?000 00000000
unsigned short background : 3; // 0???0000 00000000
unsigned short blink : 1; // ?0000000 00000000
} screen;

I looked through the MSDN and I think that it's not possible. So this
post it's to know if I'm correct or dead wrong.

Thanks
Cláudio Albuquerque
have a look at the BitVector32 struct..
Jul 18 '06 #3

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

Similar topics

0
by: renniw one | last post by:
Hi, Can anyone point me to a resource which details the process of compiling mysql server with openssl support on windows using VC++ preferable? If not, maybe someone has run across this problem...
3
by: Matthias Käppler | last post by:
Hi, I'm using a glibc system header <sys/stat.h> which defines a C struct 'stat'. Furthermore, I'm using the struct 'dirent', defined in <dirent.h>. Now, at one point in my code I'm holding an...
3
by: Jérôme de Lagausie | last post by:
Hello, In one hand, I've got a set of more than 130 different structures, mostly rather simple (a set of simple data members such as int, long, char , float ...) sample : #ifndef _H2_H_...
3
by: Christopher M. Lusardi | last post by:
Hello, Can you tell me is it my imagination, or should I not stick a "volatile" definition into a dot h file? My problem is if I put my declaration in main.c before main () my code works....
13
by: ranjeet.gupta | last post by:
Dear All What does exactly below code means struct File { void* data; }; typedef struct File File; typedef File* fl;
1
by: oo | last post by:
Hello What is the difference between these two struct definitions ? -------------------------header.h --------------------------------------- struct A{ int a; int b; struct B
2
by: James Brown | last post by:
All, Could anyone explain why the following is an error: void foo( struct FOO { int x; } f1 ) { } int main()
7
by: remlostime | last post by:
I have written a SplayTree class, what makes me wonder is when I compiled it, it has something errors: error:'SplayNode' has not been declared you can see the code below that the SplayNode has...
32
by: Stephen Horne | last post by:
I've been using Visual C++ 2003 for some time, and recently started working on making my code compile in GCC and MinGW. I hit on lots of unexpected problems which boil down to the same template...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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
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...

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.