PC Review


Reply
Thread Tools Rate Thread

A weired thing in VC++/CLR compiler

 
 
Saeed Amrollahi
Guest
Posts: n/a
 
      2nd Mar 2011
Dear All
Hi

During writing a typical Windows Form Application using CLR,
I found something strange in Visual C++ compilrer. consider the
following class:

// LoginForm.h
public ref class LoginForm : public System::Windows::Forms::Form {
LoginForm^ FillOperModeBox();
LoginForm^ FillUsernameBox();
// other stuff
};

As you see, there are two private member functions to fill
Operation Mode and Username comboboxes.
I used a varient of Method Chaning technique in C++,
because the restrictions of CLR I can't use LoginForm& as
return type, so I have to use LoginForm^. In other words,
I use 'this pointer' rather than object itself (*this).
So I can write in Form constructor:
LoginForm::LoginForm()
{
FillUsernameBox()->FillOperModeBox(); // method chaning
}

in LoginForm.cpp, I wrote:
LoginForm::FillUsernameBox()
{
// fill the combobox

}

I forgot to return this pointer.
At the moment if you compile the file (F7), there is no error,
but if you build the project, there is an error message:
LoginForm::FillOperModeBox' : must return a value
It's obvious, such thing can be caught by comipler
at separate comiplation.
Is it a bug in VC++ compiler?

Thanks in advance
-- Saeed Amrollahi
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sub(Thing as Object) {thing = new Thing.GetType} ? Kristian Frost Microsoft VB .NET 1 22nd Sep 2006 02:34 PM
A very weired problem indeed... KGB-911 Windows XP 7 28th Jan 2005 01:23 AM
fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'f:\vs70builds\3077\vc\Compiler\Utc\src\P2\main.c', line 148) PufferFish Microsoft VC .NET 10 6th Aug 2004 10:33 PM
Got a weired IP 169.254.x.x Kevin Zhu Windows XP Networking 4 22nd Feb 2004 06:17 AM
weired folders DJDJ Windows XP General 2 20th Jan 2004 05:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:20 PM.