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

Home Posts Topics Members FAQ

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 1962
<sy******@gmail .comwrote in message
news:11******** **************@ s13g2000cwa.goo glegroups.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
2447
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 and can provide a solution. I have added HAVE_OPENSSL and HAVE_VIO to the preprocessor definitions and added the libeay32.lib and ssleay32.lib to the library modules settings. It compiles fine until it gets to mysqld. Then it throws the following...
3
1680
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 std::list of dirents: std::list< dirent > mylist; This works.
3
1535
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_ #define _H2_H_
3
1949
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. But, if I move it to a dot h and include the dot h into main.c, I get an error when I run the program. I am using the volatile qualifier because I am using mmap.
13
2192
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
1153
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
2287
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
1917
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 been declared in private, why? And how can i fix it? And I have tried another way that declared the SplayNode outside the SplayTree and it works well. It really makes me confused. /* struct SplayNode
32
2731
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 issue. A noddy mixin layer example should illustrate the issue... class Base { protected: int m_Field;
0
8996
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
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
9333
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
9254
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8255
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...
0
4608
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.