473,396 Members | 2,018 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,396 software developers and data experts.

Colon in C++ private member declarations?

I have been looking over the DSO Framer example
(http://support.microsoft.com/kb/311765). As I reviewed the code, I saw
syntax that I have never come across in C++. In the header file, you see
some unsigned int private member variables with a colon and a value. It
looks like some kind of member initialization, but I did not know you could
do it that way in C++. Note that it is NOT a member initialization list as a
part of a constructor; I know what that is. Here is what it looks like:

class CDsoFramerClassFactory : public IClassFactory
{
....
private:
....
unsigned int m_fModeFlagValid:1; // has mode changed since
last check?
unsigned int m_fBorderStyle:2; // the border style
....
};

Any ideas?
Sep 9 '08 #1
3 2718
Rick Pingry wrote:
I have been looking over the DSO Framer example
(http://support.microsoft.com/kb/311765). As I reviewed the code, I saw
syntax that I have never come across in C++. In the header file, you see
some unsigned int private member variables with a colon and a value. It
looks like some kind of member initialization, but I did not know you could
do it that way in C++. Note that it is NOT a member initialization list as a
part of a constructor; I know what that is. Here is what it looks like:

class CDsoFramerClassFactory : public IClassFactory
{
...
private:
...
unsigned int m_fModeFlagValid:1; // has mode changed since
last check?
unsigned int m_fBorderStyle:2; // the border style
...
};

Any ideas?
These are bitfields, and they're as old as C.

http://msdn.microsoft.com/library/ewwyfdbe
--
J.
Sep 9 '08 #2
This is a bit field. a plain pedestrian C thing, it has no class <g>

--PA
"Rick Pingry" <Rick Pi****@discussions.microsoft.comwrote in message
news:8A**********************************@microsof t.com...
I have been looking over the DSO Framer example
(http://support.microsoft.com/kb/311765). As I reviewed the code, I saw
syntax that I have never come across in C++. In the header file, you see
some unsigned int private member variables with a colon and a value. It
looks like some kind of member initialization, but I did not know you
could
do it that way in C++. Note that it is NOT a member initialization list as
a
part of a constructor; I know what that is. Here is what it looks like:

class CDsoFramerClassFactory : public IClassFactory
{
...
private:
...
unsigned int m_fModeFlagValid:1; // has mode changed since
last check?
unsigned int m_fBorderStyle:2; // the border style
...
};

Any ideas?
Sep 9 '08 #3
Wow, thanks for the fast response, with a link even!
Sep 9 '08 #4

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

Similar topics

6
by: Chris Mantoulidis | last post by:
Forgive me if I'm wrong but I think there is something like an extra member scope in classes. for example: class abc { ostream & operator << (ostream &, const abc &); istream & operator >>...
12
by: Bryan Parkoff | last post by:
CMain Class is the base class that is initialized in main function. CA Class is the base class that is initialized in CMain::CMain(). CMain Class is always public while CA Class is always...
3
by: Leszek Tumm | last post by:
Hi. Can you help solve a problem with operator overloading ? in one file i have definition of my class and declarations of overloaded operators: class Complex { long double Re;
6
by: Andre Eisenbach | last post by:
Should this code compile or not? class A { void f(); }; class B { friend void A::f();
6
by: Jonathan Potter | last post by:
Hi, I was wondering if someone could explain something to me. We recently upgraded to a new C++ compiler and found some old code wouldn't compile. Boiled down, the code that causes the error is:...
5
by: Neil Steventon | last post by:
Hi, I am new to VB.net , well the objects concept anyway and was wondering if there were any good articles / turorials on when and why you would use certain declarations such as Private test...
23
by: Ben Voigt | last post by:
I have a POD type with a private destructor. There are a whole hierarchy of derived POD types, all meant to be freed using a public member function Destroy in the base class. I get warning C4624....
63
by: time.swift | last post by:
Coming from a C++ / C# background, the lack of emphasis on private data seems weird to me. I've often found wrapping private data useful to prevent bugs and enforce error checking.. It appears...
15
by: akomiakov | last post by:
Is there a technical reason why one can't initialize a cost static non- integral data member in a class?
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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
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...

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.