Click here to Skip to main content
15,885,141 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Drivers to access parallel port in c using windows xp or 7 ?? Pin
Erudite_Eric17-Mar-13 1:18
Erudite_Eric17-Mar-13 1:18 
AnswerRe: Drivers to access parallel port in c using windows xp or 7 ?? Pin
_Flaviu17-Mar-13 20:49
_Flaviu17-Mar-13 20:49 
QuestionC++ Code to call a Rest Based Web Service API Pin
raghunath sahoo15-Mar-13 7:56
raghunath sahoo15-Mar-13 7:56 
AnswerRe: C++ Code to call a Rest Based Web Service API Pin
Albert Holguin15-Mar-13 8:34
professionalAlbert Holguin15-Mar-13 8:34 
GeneralRe: C++ Code to call a Rest Based Web Service API Pin
raghunath sahoo15-Mar-13 8:55
raghunath sahoo15-Mar-13 8:55 
GeneralRe: C++ Code to call a Rest Based Web Service API Pin
raghunath sahoo15-Mar-13 8:57
raghunath sahoo15-Mar-13 8:57 
AnswerRe: C++ Code to call a Rest Based Web Service API Pin
Albert Holguin15-Mar-13 9:32
professionalAlbert Holguin15-Mar-13 9:32 
QuestionVC++ and Empty Base Class Optimization problem/bug Pin
Kosta Cherry15-Mar-13 4:45
Kosta Cherry15-Mar-13 4:45 
Here is the test code:
http://codepad.org/zKTatneG[^]

struct Empty
{
};

struct JustLong
{
long data;
};

struct LongAndEmpty : public JustLong, private Empty
{
};

struct StringAndEmpty: public std::string, private Empty
{
};

int main()
{
cout << "Empty:" << sizeof(Empty) << endl;
cout << "JustLong:" << sizeof(JustLong) << endl;
cout << "String:" << sizeof(std::string) << endl;
cout << "LongAndEmpty:" << sizeof(LongAndEmpty) << endl;
cout << "StringAndEmpty:" << sizeof(StringAndEmpty) << endl;
return 0;
}

When you try it in other compiler (for example, see link above for codepad.org), results are correct, i.e. output looks like this:
Empty:1
JustLong:4
String:4
LongAndEmpty:4
StringAndEmpty:4

Now, when you try this in VC++ (2010), size of struct with std::string is always (debug and release) 4 more that size of just std::string. Any other structs/classes are of correct size, and only those with std::string are bigger than they should be. Am I missing something or this is MS bug?
AnswerRe: VC++ and Empty Base Class Optimization problem/bug Pin
Matthew Faithfull15-Mar-13 6:01
Matthew Faithfull15-Mar-13 6:01 
GeneralRe: VC++ and Empty Base Class Optimization problem/bug Pin
Kosta Cherry15-Mar-13 6:23
Kosta Cherry15-Mar-13 6:23 
GeneralRe: VC++ and Empty Base Class Optimization problem/bug Pin
Matthew Faithfull15-Mar-13 6:36
Matthew Faithfull15-Mar-13 6:36 
GeneralRe: VC++ and Empty Base Class Optimization problem/bug Pin
David Crow15-Mar-13 7:34
David Crow15-Mar-13 7:34 
GeneralRe: VC++ and Empty Base Class Optimization problem/bug Pin
Kosta Cherry15-Mar-13 8:45
Kosta Cherry15-Mar-13 8:45 
AnswerRe: VC++ and Empty Base Class Optimization problem/bug Pin
jschell15-Mar-13 8:56
jschell15-Mar-13 8:56 
QuestionHow Can I set Noise In Image ? Pin
002comp14-Mar-13 19:25
002comp14-Mar-13 19:25 
AnswerRe: How Can I set Noise In Image ? Pin
Marco Bertschi14-Mar-13 22:21
protectorMarco Bertschi14-Mar-13 22:21 
AnswerRe: How Can I set Noise In Image ? Pin
nv316-Mar-13 2:16
nv316-Mar-13 2:16 
QuestiontimeGetTime() is unreliable on my computer too, not monotonic! Pin
Robert Inventor14-Mar-13 18:04
Robert Inventor14-Mar-13 18:04 
AnswerMessage Closed Pin
14-Mar-13 18:15
Robert Inventor14-Mar-13 18:15 
GeneralMessage Closed Pin
14-Mar-13 18:20
Robert Inventor14-Mar-13 18:20 
GeneralMessage Closed Pin
14-Mar-13 18:53
Robert Inventor14-Mar-13 18:53 
GeneralMessage Closed Pin
14-Mar-13 19:19
Robert Inventor14-Mar-13 19:19 
AnswerRe: timeGetTime() is unreliable on my computer too, not monotonic! Pin
Robert Inventor19-Mar-13 7:31
Robert Inventor19-Mar-13 7:31 
QuestionQueryPerformanceCounter inaccurate timing even with use of SetThreadAffinityMask Pin
Robert Inventor14-Mar-13 15:50
Robert Inventor14-Mar-13 15:50 
AnswerRe: QueryPerformanceCounter inaccurate timing even with use of SetThreadAffinityMask Pin
Robert Inventor14-Mar-13 18:07
Robert Inventor14-Mar-13 18:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.