Click here to Skip to main content
15,894,291 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Please help me draw on my desktop behind the icons Pin
Christian Graus19-May-05 16:24
protectorChristian Graus19-May-05 16:24 
Generalplease help on CListCtrl and LVN_BEGINLABELEDIT Pin
lucy19-May-05 11:13
lucy19-May-05 11:13 
QuestionHow to go about mixing C++ dll with C# forms for use in a scripting language that can call dlls Pin
KnaveR77719-May-05 10:52
KnaveR77719-May-05 10:52 
GeneralI need control over other windows. Pin
bugDanny19-May-05 10:47
bugDanny19-May-05 10:47 
GeneralRe: I need control over other windows. Pin
Joel Holdsworth19-May-05 11:10
Joel Holdsworth19-May-05 11:10 
GeneralRe: I need control over other windows. Pin
bugDanny20-May-05 5:19
bugDanny20-May-05 5:19 
GeneralRe: I need control over other windows. Pin
Joel Holdsworth20-May-05 6:42
Joel Holdsworth20-May-05 6:42 
GeneralOverloaded operators and enums Pin
Andrew Manison19-May-05 9:49
Andrew Manison19-May-05 9:49 
Can anyone explain what is happening here? I am trying to create overloaded relational operators for class member enums. VC6.0 and gcc 3.3.4 compile the code fine. VC7.0 and 7.1 complain that the overloaded operator function is ambiguous. The following code illustrates the problem:

class A
{
public:
enum level
{
none, low, medium, high
};
};

bool operator>( A::level l1, A::level l2 )
{
bool greater = false;

switch( l1 )
{
case A::low:
switch( l2 )
{
case A::none: greater = true; break;
}
break;
case A::medium:
switch( l2 )
{
case A::low:
case A::none: greater = true; break;
}
break;
case A::high:
switch( l2 )
{
case A::medium:
case A::low:
case A::none: greater = true; break;
}
break;
}
return greater;
}

int
main( int argc, char * argv[] )
{
A::level l1 = A::high;
A::level l2 = A::low;

if( l1 < l2 )
{
return 1;
}
if( l1 > l2 )
{
return -1;
}
return 0;
}

VC6.0 and gcc compile cleanly. VC7.0 and 7.1 fail with the following error:

Compiling...
enumtest.cpp
d:\misc\test.cpp(54) : error C2593: 'operator >' is ambiguous
d:\misc\test.cpp(13): could be 'bool operator >(A::level,A::level)'
or 'built-in C++ operator>(A::level, A::level)'
while trying to match the argument list '(A::level, A::level)'

What are the built-in operators mentioned? Is the compiler assuming that an enum-is-an-enum-is-an enum, and thus bypasses the strong typing? What is the correct way to write this that conforms to the standard and is portable?

Any and all insights will be welcome.
Generalanother small pointers problem Pin
Mridang Agarwalla19-May-05 8:21
Mridang Agarwalla19-May-05 8:21 
GeneralRe: another small pointers problem Pin
Monty219-May-05 8:32
Monty219-May-05 8:32 
GeneralRe: another small pointers problem Pin
David Crow19-May-05 8:35
David Crow19-May-05 8:35 
GeneralSocket Question Pin
talkster519-May-05 8:19
talkster519-May-05 8:19 
GeneralRe: Socket Question Pin
Ryan Binns19-May-05 18:11
Ryan Binns19-May-05 18:11 
GeneralRe: Socket Question Pin
talkster519-May-05 19:58
talkster519-May-05 19:58 
GeneralRe: Socket Question Pin
talkster520-May-05 3:39
talkster520-May-05 3:39 
GeneralRe: Socket Question Pin
talkster520-May-05 4:38
talkster520-May-05 4:38 
GeneralIncomplete Stack trace from Minidump using WinDbg Pin
JayVSub19-May-05 8:00
JayVSub19-May-05 8:00 
GeneralRe: Incomplete Stack trace from Minidump using WinDbg Pin
doublebug21-May-05 1:57
doublebug21-May-05 1:57 
GeneralHelp: App crashes using Chris GridCtrl in DLL and Release Mode (has anyone same problem or a workaround) Pin
Ralph19-May-05 7:22
Ralph19-May-05 7:22 
GeneralRe: Help: App crashes using Chris GridCtrl in DLL and Release Mode (has anyone same problem or a workaround) Pin
Ryan Binns19-May-05 18:30
Ryan Binns19-May-05 18:30 
GeneralRe: Help: App crashes using Chris GridCtrl in DLL and Release Mode (has anyone same problem or a workaround) Pin
Ralph20-May-05 3:49
Ralph20-May-05 3:49 
Questionwhat are memory leaks? Pin
Mridang Agarwalla19-May-05 6:38
Mridang Agarwalla19-May-05 6:38 
AnswerRe: what are memory leaks? Pin
toxcct19-May-05 6:48
toxcct19-May-05 6:48 
GeneralThose *#@!$+ Memory Leaks Pin
Uwe Keim19-May-05 5:58
sitebuilderUwe Keim19-May-05 5:58 
GeneralRe: Those *#@!$+ Memory Leaks Pin
jmkhael19-May-05 6:19
jmkhael19-May-05 6:19 

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.